coders/png.c: Fixed writer bug due to missing brackets
authorGlenn Randers-Pehrson <glennrp+bmo@gmail.com>
Tue, 25 Jul 2017 20:18:42 -0400
changeset 15099 f423ba88ca4e
parent 15098 d1e56efb0162
child 15100 4e49e944e9fd
coders/png.c: Fixed writer bug due to missing brackets
ChangeLog
coders/png.c
--- a/ChangeLog	Tue Jul 25 19:38:39 2017 -0400
+++ b/ChangeLog	Tue Jul 25 20:18:42 2017 -0400
@@ -5,6 +5,9 @@
 	* coders/png.c: Removed some redundant checks for chunk length
 	before MagickFreeMemory(chunk), which is safe to call with a
 	NULL argument.
+	* coders/png.c: Fixed writer bug due to missing brackets; a Log
+	statement should have been inside the "i" loop but instead was
+	using i++ left over from the loop.  Bug report by L. Catro.
 
 2017-07-22  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
 
--- a/coders/png.c	Tue Jul 25 19:38:39 2017 -0400
+++ b/coders/png.c	Tue Jul 25 20:18:42 2017 -0400
@@ -7125,12 +7125,14 @@
                           png_error(ping, "Could not allocate trans_alpha");
 
                         for (i=0; i<(int) number_colors; i++)
-                          if (trans_alpha[i] == 256)
-                             ping_trans_alpha[i]=255;
-                          else
-                             ping_trans_alpha[i]=(png_byte) trans_alpha[i];
-                         (void) LogMagickEvent(CoderEvent, GetMagickModule(),
-                            "    Alpha[%d]=%d",(int) i, (int) trans_alpha[i]);
+                          {
+                            if (trans_alpha[i] == 256)
+                               ping_trans_alpha[i]=255;
+                            else
+                               ping_trans_alpha[i]=(png_byte) trans_alpha[i];
+                           (void) LogMagickEvent(CoderEvent, GetMagickModule(),
+                              "    Alpha[%d]=%d",(int) i, (int) trans_alpha[i]);
+                          }
                       }
                   }