From ea2d32381ddc872f6cee843675fd3c49a3cb9c0d Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 11 Oct 2006 00:19:12 +0000 Subject: [PATCH] - don't check signature if the file is empty (valgrind reports with test 001), thx Tony for the head up --- ext/gd/libgd/gd_png.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c index fcc9a008ab..b99c33c8c2 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; } -- 2.40.0