]> granicus.if.org Git - php/commitdiff
- don't check signature if the file is empty (valgrind reports with test
authorPierre Joye <pajoye@php.net>
Wed, 11 Oct 2006 00:19:12 +0000 (00:19 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 11 Oct 2006 00:19:12 +0000 (00:19 +0000)
  001), thx Tony for the head up

ext/gd/libgd/gd_png.c

index fcc9a008abe80450014505020dd5ae72f4d4047f..b99c33c8c261757454e73bddbf65e40dd705a0e3 100644 (file)
@@ -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;
        }