From b5df6c9243153c0c35de9befd7e347127f320e5e Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Tue, 29 Aug 2017 21:03:16 -0400
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/702

---
 coders/png.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/coders/png.c b/coders/png.c
index 99b83225f..a35b77467 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -3261,25 +3261,6 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
             image->colormap[i].blue=0;
           }
         }
-
-      else
-        {
-          Quantum
-            scale;
-
-          scale = (Quantum) (65535.0/((1UL << ping_file_depth)-1.0));
-
-#if (MAGICKCORE_QUANTUM_DEPTH > 16)
-          scale = ScaleShortToQuantum(scale);
-#endif
-
-          for (i=0; i < (ssize_t) image->colors; i++)
-          {
-            image->colormap[i].red=(Quantum) (i*scale);
-            image->colormap[i].green=(Quantum) (i*scale);
-            image->colormap[i].blue=(Quantum) (i*scale);
-          }
-       }
     }
 
    /* Set some properties for reporting by "identify" */
@@ -3660,6 +3641,9 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
             break;
         }
 
+        if (SyncAuthenticPixels(image,exception) == MagickFalse)
+          break;
+
         /*
           Transfer image scanline.
         */
-- 
2.40.0