Skip to content

Commit ea2d323

Browse files
committed
- don't check signature if the file is empty (valgrind reports with test
001), thx Tony for the head up
1 parent 03641dc commit ea2d323

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/gd/libgd/gd_png.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
131131
/* first do a quick check that the file really is a PNG image; could
132132
* have used slightly more general png_sig_cmp() function instead
133133
*/
134-
gdGetBuf(sig, 8, infile);
134+
if (gdGetBuf(sig, 8, infile) < 8) {
135+
return NULL;
136+
}
137+
135138
if (!png_check_sig (sig, 8)) { /* bad signature */
136139
return NULL;
137140
}

0 commit comments

Comments
 (0)