cvs: gd(GD_2_0) /libgd gd_gif_in.c

From: Date: Wed, 04 Apr 2007 11:33:42 +0000
Subject: cvs: gd(GD_2_0) /libgd gd_gif_in.c
Groups: php.gd.cvs 
Request: Send a blank email to php-gd-cvs+get-167@lists.php.net to get a copy of this message
pajoye Wed Apr 4 11:33:42 2007 UTC Modified files: (Branch: GD_2_0) /gd/libgd gd_gif_in.c Log: - #70, do not try to use the global color map if none exists - free im on error http://cvs.php.net/viewvc.cgi/gd/libgd/gd_gif_in.c?r1=1.5.2.5&r2=1.5.2.6&diff_format=u Index: gd/libgd/gd_gif_in.c diff -u gd/libgd/gd_gif_in.c:1.5.2.5 gd/libgd/gd_gif_in.c:1.5.2.6 --- gd/libgd/gd_gif_in.c:1.5.2.5 Sun Apr 1 19:54:17 2007 +++ gd/libgd/gd_gif_in.c Wed Apr 4 11:33:42 2007 @@ -135,6 +135,7 @@ /*1.4//int imageCount = 0; */ /* 2.0.28: threadsafe storage */ int ZeroDataBlock = FALSE; + int haveGlobalColormap; gdImagePtr im = 0; if (! ReadOK(fd,buf,6)) { @@ -164,11 +165,12 @@ screen_width = imw = LM_to_uint(buf[0],buf[1]); screen_height = imh = LM_to_uint(buf[2],buf[3]); - if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */ - if (ReadColorMap(fd, BitPixel, ColorMap)) { - return 0; - } - } + haveGlobalColormap = BitSet(buf[4], LOCALCOLORMAP); /* Global Colormap */ + if (haveGlobalColormap) { + if (ReadColorMap(fd, BitPixel, ColorMap)) { + return 0; + } + } for (;;) { int top, left; int width, height; @@ -217,13 +219,18 @@ return 0; } im->interlace = BitSet(buf[8], INTERLACE); - if (! useGlobalColormap) { + if (!useGlobalColormap) { if (ReadColorMap(fd, bitPixel, localColorMap)) { - return 0; + gdImageDestroy(im); + return 0; } ReadImage(im, fd, width, height, localColorMap, BitSet(buf[8], INTERLACE), &ZeroDataBlock); } else { + if (!haveGlobalColormap) { + gdImageDestroy(im); + return 0; + } ReadImage(im, fd, width, height, ColorMap, BitSet(buf[8], INTERLACE), &ZeroDataBlock); @@ -293,8 +300,7 @@ if ((buf[0] & 0x1) != 0) *Transparent = buf[3]; - while (GetDataBlock(fd, (unsigned char*) buf, ZeroDataBlockP) > 0) - ; + while (GetDataBlock(fd, (unsigned char*) buf, ZeroDataBlockP) > 0); return FALSE; default: break;

« previous php.gd.cvs (#167) next »