From: Pierre Joye Date: Wed, 11 Oct 2006 00:21:33 +0000 (+0000) Subject: - don't check signature if the file is empty (valgrind reports with test X-Git-Tag: RELEASE_1_0_0RC1~1320 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e1b7b03f858664c4eb0014f50bebe71790cd7f5;p=php - don't check signature if the file is empty (valgrind reports with test 001), thx Tony for the head up --- diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c index 45ec475827..b5245bd6c4 100644 --- a/ext/gd/libgd/gd_png.c +++ b/ext/gd/libgd/gd_png.c @@ -131,7 +131,10 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile) /* first do a quick check that the file really is a PNG image; could * have used slightly more general png_sig_cmp() function instead */ - gdGetBuf(sig, 8, infile); + if (gdGetBuf(sig, 8, infile) < 8) { + return NULL; + } + if (!png_check_sig (sig, 8)) { /* bad signature */ return NULL; }