]> 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:21:33 +0000 (00:21 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 11 Oct 2006 00:21:33 +0000 (00:21 +0000)
  001), thx Tony for the head up

ext/gd/libgd/gd_png.c

index 45ec47582700c198516db79f11b590955af09b9b..b5245bd6c4039b352fbfa870a2443cd838e79c36 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;
        }