diff options
author | Pierre Joye <pajoye@php.net> | 2006-05-08 14:04:39 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2006-05-08 14:04:39 +0000 |
commit | 727982d2684132e2d5c3347b14a28ba0c2327ccc (patch) | |
tree | b38e1c550645bd1d192b46df9a9dceff1c6c28c1 | |
parent | 7a80b0a24b20ecde3f06c6d296dbd758fdb5a159 (diff) | |
download | php-git-727982d2684132e2d5c3347b14a28ba0c2327ccc.tar.gz |
- MFH: #37346, invalid colormap format
- MFH: #37360, bad gif size
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/gd/libgd/gd_gif_in.c | 16 | ||||
-rw-r--r-- | ext/gd/tests/bug37346.gif | 4 | ||||
-rw-r--r-- | ext/gd/tests/bug37346.phpt | 13 | ||||
-rw-r--r-- | ext/gd/tests/bug37360.gif | bin | 0 -> 65646 bytes | |||
-rw-r--r-- | ext/gd/tests/bug37360.phpt | 14 |
6 files changed, 43 insertions, 6 deletions
@@ -4,7 +4,9 @@ PHP 4 NEWS - Updated PCRE to version 6.6. (Andrei) - Added overflow checks to wordwrap() function. (Ilia) - Added a check for special characters in the session name. (Ilia) +- Fixed bug #34360 (bad gif size) (Pierre) - Fixed bug #37348 (make PEAR install ignore open_basedir). (Ilia) +- Fixed bug #37346 (invalid colormap format) (Pierre) - Fixed bug #37162 (wddx does not build as a shared extension). (jdolecek at NetBSD dot org, Ilia) - Fixed bug #37046 (foreach breaks static scope). (Dmitry) diff --git a/ext/gd/libgd/gd_gif_in.c b/ext/gd/libgd/gd_gif_in.c index e8817d7720..092c89a5d8 100644 --- a/ext/gd/libgd/gd_gif_in.c +++ b/ext/gd/libgd/gd_gif_in.c @@ -147,7 +147,10 @@ gdImageCreateFromGifCtx(gdIOCtxPtr fd) Background = buf[5]; AspectRatio = buf[6]; - if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */ + imw = LM_to_uint(buf[0],buf[1]); + imh = LM_to_uint(buf[2],buf[3]); + + if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */ if (ReadColorMap(fd, BitPixel, ColorMap)) { return 0; } @@ -182,16 +185,17 @@ gdImageCreateFromGifCtx(gdIOCtxPtr fd) bitPixel = 1<<((buf[8]&0x07)+1); - imw = LM_to_uint(buf[4],buf[5]); - imh = LM_to_uint(buf[6],buf[7]); + if (!useGlobalColormap) { + if (ReadColorMap(fd, bitPixel, localColorMap)) { + return 0; + } + } + if (!(im = gdImageCreate(imw, imh))) { return 0; } im->interlace = BitSet(buf[8], INTERLACE); if (! useGlobalColormap) { - if (ReadColorMap(fd, bitPixel, localColorMap)) { - return 0; - } ReadImage(im, fd, imw, imh, localColorMap, BitSet(buf[8], INTERLACE)); /*1.4//imageCount != imageNumber); */ diff --git a/ext/gd/tests/bug37346.gif b/ext/gd/tests/bug37346.gif new file mode 100644 index 0000000000..76ce1e398e --- /dev/null +++ b/ext/gd/tests/bug37346.gif @@ -0,0 +1,4 @@ +GIF89a
+<
+
+看吧, 我都说过滤不严了
\ No newline at end of file diff --git a/ext/gd/tests/bug37346.phpt b/ext/gd/tests/bug37346.phpt new file mode 100644 index 0000000000..4677a1acef --- /dev/null +++ b/ext/gd/tests/bug37346.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #37346 (gdimagecreatefromgif, bad colormap) +--SKIPIF-- +<?php + if (!extension_loaded('gd')) die("skip gd extension not available\n"); + if (!GD_BUNDLED) die('skip external GD libraries always fail'); +?> +--FILE-- +<?php +$im = imagecreatefromgif(dirname(__FILE__) . '/bug37346.gif'); +?> +--EXPECTF-- +Warning: imagecreatefromgif() [%s]: '%sbug37346.gif' is not a valid GIF file in %sbug37346.php on line %d diff --git a/ext/gd/tests/bug37360.gif b/ext/gd/tests/bug37360.gif Binary files differnew file mode 100644 index 0000000000..3f9e6c5e40 --- /dev/null +++ b/ext/gd/tests/bug37360.gif diff --git a/ext/gd/tests/bug37360.phpt b/ext/gd/tests/bug37360.phpt new file mode 100644 index 0000000000..dce22e7c6f --- /dev/null +++ b/ext/gd/tests/bug37360.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #37360 (gdimagecreatefromgif, bad image sizes) +--SKIPIF-- +<?php + if (!extension_loaded('gd')) die("skip gd extension not available\n"); + if (!GD_BUNDLED) die('skip external GD libraries always fail'); +?> +--FILE-- +<?php +$im = imagecreatefromgif(dirname(__FILE__) . '/bug37360.gif'); +var_dump($im); +?> +--EXPECTF-- +resource(%d) of type (gd) |