pajoye          Wed Apr  4 11:42:54 2007 UTC

  Modified files:              
    /php-src/ext/gd/libgd       gd_gif_in.c 
  Log:
  - MFH:
   - do not try to use the global color map when none was found (Nuno, Pierre)
   - free im on error
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_gif_in.c?r1=1.15&r2=1.16&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.15 
php-src/ext/gd/libgd/gd_gif_in.c:1.16
--- php-src/ext/gd/libgd/gd_gif_in.c:1.15       Wed Apr  4 01:54:34 2007
+++ php-src/ext/gd/libgd/gd_gif_in.c    Wed Apr  4 11:42:54 2007
@@ -143,7 +143,7 @@
        /*1.4//int             imageCount = 0; */
 
        int ZeroDataBlock = FALSE;
-
+       int haveGlobalColormap;
        gdImagePtr im = 0;
 
        /*1.4//imageNumber = 1; */
@@ -175,11 +175,13 @@
        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 */
+       haveGlobalColormap = BitSet(buf[4], LOCALCOLORMAP);    /* Global 
Colormap */
+       if (haveGlobalColormap) {
                if (ReadColorMap(fd, BitPixel, ColorMap)) {
                        return 0;
                }
        }
+
        for (;;) {
                int top, left;
                int width, height;
@@ -230,11 +232,16 @@
                im->interlace = BitSet(buf[8], INTERLACE);
                if (!useGlobalColormap) {
                        if (ReadColorMap(fd, bitPixel, localColorMap)) {
+                               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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to