summaryrefslogtreecommitdiff
path: root/ext/gd/libgd/gd_png.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/libgd/gd_png.c')
-rw-r--r--ext/gd/libgd/gd_png.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c
index fcc9a008a..b99c33c8c 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;
}