cvs: php-src /ext/gd/libgd gd_gif_in.c /ext/gd/tests bug37346.gif bug37346.phpt

From: Date: Sun, 07 May 2006 17:21:11 +0000
Subject: cvs: php-src /ext/gd/libgd gd_gif_in.c /ext/gd/tests bug37346.gif bug37346.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-38058@lists.php.net to get a copy of this message
pajoye Sun May 7 17:21:11 2006 UTC Modified files: /php-src/ext/gd/tests bug37346.phpt bug37346.gif /php-src/ext/gd/libgd gd_gif_in.c Log: - MFB: #37346, invalid colormap format http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/bug37346.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/gd/tests/bug37346.phpt diff -u /dev/null php-src/ext/gd/tests/bug37346.phpt:1.2 --- /dev/null Sun May 7 17:21:11 2006 +++ php-src/ext/gd/tests/bug37346.phpt Sun May 7 17:21:11 2006 @@ -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(): '%sbug37346.gif' is not a valid GIF file in %sbug37346.php on line %d http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/bug37346.gif?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/gd/tests/bug37346.gif diff -u /dev/null php-src/ext/gd/tests/bug37346.gif:1.2 --- /dev/null Sun May 7 17:21:11 2006 +++ php-src/ext/gd/tests/bug37346.gif Sun May 7 17:21:11 2006 @@ -0,0 +1,4 @@ +GIF89a +< + +¿´°É, ÎÒ¶¼Ëµ¹ýÂ˲»ÑÏÁË \ No newline at end of file http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/libgd/gd_gif_in.c?r1=1.7&r2=1.8&diff_format=u Index: php-src/ext/gd/libgd/gd_gif_in.c diff -u php-src/ext/gd/libgd/gd_gif_in.c:1.7 php-src/ext/gd/libgd/gd_gif_in.c:1.8 --- php-src/ext/gd/libgd/gd_gif_in.c:1.7 Sat Sep 24 14:37:49 2005 +++ php-src/ext/gd/libgd/gd_gif_in.c Sun May 7 17:21:11 2006 @@ -44,7 +44,7 @@ #define LOCALCOLORMAP 0x80 #define BitSet(byte, bit) (((byte) & (bit)) == (bit)) -#define ReadOK(file,buffer,len) (gdGetBuf(buffer, len, file) != 0) +#define ReadOK(file,buffer,len) (gdGetBuf(buffer, len, file) > 0) #define LM_to_uint(a,b) (((b)<<8)|(a)) @@ -184,14 +184,19 @@ imw = LM_to_uint(buf[4],buf[5]); imh = LM_to_uint(buf[6],buf[7]); - if (!(im = gdImageCreate(imw, imh))) { - return 0; - } - im->interlace = BitSet(buf[8], INTERLACE); + + 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); */

« previous php.cvs (#38058) next »