File php-CVE-2019-11038.patch of Package php7.13659
X-Git-Url: http://208.43.231.11:8000/?p=php-src.git;a=blobdiff_plain;f=ext%2Fgd%2Flibgd%2Fxbm.c;h=bde590d151186c76e8bc95c96ebe3160d4783328;hp=6ff18cdee07418735e1f849fda082a99c45b8202;hb=ed6dee9a198c904ad5e03113e58a2d2c200f5184;hpb=f80ad18afae2230c2c1802c7d829100af646874e
diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/xbm.c
index 6ff18cd..bde590d 100644
--- a/ext/gd/libgd/xbm.c
+++ b/ext/gd/libgd/xbm.c
@@ -135,7 +135,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) {