]> granicus.if.org Git - imagemagick/commitdiff
Remove bogus image->colormap that is passed in to the PNG encoder with a
authorglennrp <glennrp@git.imagemagick.org>
Wed, 6 Apr 2011 18:07:30 +0000 (18:07 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Wed, 6 Apr 2011 18:07:30 +0000 (18:07 +0000)
non-PseudoClass image.

ChangeLog
coders/png.c

index e0af0b9b6ec9d9028e56f048658981dd2cb609ad..5d55600ed63a74bec1e02f2a44bfb53f4c11c5ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,9 @@
   * Make the PNG encoder use depth==8 when incoming image->depth < 8
     (the encoder later reduces the depth if it can), to avoid writing
     an incorrect image.
+  * Remove any bogus colormap received by the PNG encoder with an image
+    that is not PseudoClass (reference
+    http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=18475).
 
 2011-04-02  6.6.9-3 Cristy  <quetzlzacatenango@image...>
   * Added -statistic Gradient
index 67f187df91cf3d04aa2ffe27c688ecda6b83dd42..32566392c6e164389b2eb26c69a60fd34d2942f9 100644 (file)
@@ -7070,6 +7070,16 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
           (void) LogMagickEvent(CoderEvent,GetMagickModule(),
           "    storage_class=PseudoClass");
     }
+
+  if (image->storage_class != PseudoClass && image->colormap != NULL)
+    {
+      /* Free the bogus colormap; it can cause trouble later */
+       if (logging != MagickFalse)
+          (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+          "    Freeing bogus colormap");
+       (void *) RelinquishMagickMemory(image->colormap);
+       image->colormap=NULL;
+    }
    
   if (image->colorspace != RGBColorspace)
     (void) TransformImageColorspace(image,RGBColorspace);