diff options
Diffstat (limited to 'Build/source/libs/gd/libgd-src/src/gd_xbm.c')
-rw-r--r-- | Build/source/libs/gd/libgd-src/src/gd_xbm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Build/source/libs/gd/libgd-src/src/gd_xbm.c b/Build/source/libs/gd/libgd-src/src/gd_xbm.c index 29bc5c2e8d5..cf0545efdb4 100644 --- a/Build/source/libs/gd/libgd-src/src/gd_xbm.c +++ b/Build/source/libs/gd/libgd-src/src/gd_xbm.c @@ -169,7 +169,11 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromXbm(FILE * fd) } h[3] = ch; } - sscanf(h, "%x", &b); + if (sscanf(h, "%x", &b) != 1) { + 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) { @@ -220,7 +224,7 @@ static void gdCtxPrintf(gdIOCtx * out, const char *format, ...) * gd - Which color to use as forground color. All pixels with another * color are unset. * out - The <gdIOCtx> to write the image file to. - * + * */ BGD_DECLARE(void) gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out) { |