diff options
author | Pierre Joye <pajoye@php.net> | 2006-05-08 11:50:47 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2006-05-08 11:50:47 +0000 |
commit | 4428076eae133b1570bc3d83dad496e37a77f9b4 (patch) | |
tree | 9545a0c0fff2c0065f48c16b04ce4f7e65c1e721 | |
parent | 570511c9b2e06cd0f8cbb69d17e025693864030d (diff) | |
download | php-git-4428076eae133b1570bc3d83dad496e37a77f9b4.tar.gz |
- MFH: #37360, bad gif size
-rw-r--r-- | ext/gd/libgd/gd_gif_in.c | 6 | ||||
-rw-r--r-- | ext/gd/tests/bug37360.gif | bin | 0 -> 65646 bytes | |||
-rw-r--r-- | ext/gd/tests/bug37360.phpt | 14 |
3 files changed, 17 insertions, 3 deletions
diff --git a/ext/gd/libgd/gd_gif_in.c b/ext/gd/libgd/gd_gif_in.c index 59c698d871..3944aad66b 100644 --- a/ext/gd/libgd/gd_gif_in.c +++ b/ext/gd/libgd/gd_gif_in.c @@ -147,6 +147,9 @@ gdImageCreateFromGifCtx(gdIOCtxPtr fd) Background = buf[5]; AspectRatio = buf[6]; + 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,9 +185,6 @@ 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; 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) |