summaryrefslogtreecommitdiff
path: root/ext/gd/libgd
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/libgd')
-rw-r--r--ext/gd/libgd/gd_xbm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/gd/libgd/gd_xbm.c b/ext/gd/libgd/gd_xbm.c
index a37d833d3b..70d9b41057 100644
--- a/ext/gd/libgd/gd_xbm.c
+++ b/ext/gd/libgd/gd_xbm.c
@@ -136,7 +136,11 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd)
}
h[3] = ch;
}
- sscanf(h, "%x", &b);
+ if (sscanf(h, "%x", &b) != 1) {
+ php_gd_error("invalid XBM");
+ gdImageDestroy(im);
+ return 0;
+ }
for (bit = 1; bit <= max_bit; bit = bit << 1) {
gdImageSetPixel(im, x++, y, (b & bit) ? 1 : 0);
if (x == im->sx) {