From 2e1b7b03f858664c4eb0014f50bebe71790cd7f5 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 11 Oct 2006 00:21:33 +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 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; } -- 2.50.1