]> granicus.if.org Git - php/commitdiff
- #38112, add test and use MAX_LWZ_BITS instead of the value
authorPierre Joye <pajoye@php.net>
Mon, 17 Jul 2006 14:30:21 +0000 (14:30 +0000)
committerPierre Joye <pajoye@php.net>
Mon, 17 Jul 2006 14:30:21 +0000 (14:30 +0000)
ext/gd/libgd/gd_gif_in.c
ext/gd/tests/bug38112.gif [new file with mode: 0644]
ext/gd/tests/bug38112.phpt [new file with mode: 0644]

index b4bc7752d0e9691d42cdcca820fe3b57f0961229..e3d635b31f5014018dda20d4e57e8e32748145a8 100644 (file)
@@ -522,7 +522,7 @@ static void ReadImage(gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned
                return;
        }
 
-       if (c > 8) {
+       if (c > MAX_LWZ_BITS) {
                return; 
        }
 
diff --git a/ext/gd/tests/bug38112.gif b/ext/gd/tests/bug38112.gif
new file mode 100644 (file)
index 0000000..178d27e
Binary files /dev/null and b/ext/gd/tests/bug38112.gif differ
diff --git a/ext/gd/tests/bug38112.phpt b/ext/gd/tests/bug38112.phpt
new file mode 100644 (file)
index 0000000..6c52271
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Bug #38112 (GIF Invalid Code size ).
+--SKIPIF--
+<?php 
+       if (!extension_loaded('gd')) {  
+               die("skip gd extension not available\n");
+       }
+       if (!GD_BUNDLED) {
+               die('skip external GD libraries may fail');
+       }
+?>
+--FILE--
+<?php
+$im = imagecreatefromgif(dirname(__FILE__) . '/bug38112.gif');
+?>
+--EXPECTF--
+Warning: imagecreatefromgif(): '%sbug38112.gif' is not a valid GIF file in %sbug38112.php on line %d