]> granicus.if.org Git - imagemagick/commitdiff
Fixed decreasing the number of packets.
authordirk <dirk@git.imagemagick.org>
Tue, 27 Sep 2016 19:29:53 +0000 (21:29 +0200)
committerdirk <dirk@git.imagemagick.org>
Tue, 27 Sep 2016 19:29:53 +0000 (21:29 +0200)
coders/sgi.c

index 0ccd9c031342c53d737cc5e4d9cf576d265857dc..8262a6c77a0e2a12a1d8fe7e3d3881e95304d304 100644 (file)
@@ -205,12 +205,12 @@ static MagickBooleanType SGIDecode(const size_t bytes_per_pixel,
           }
         else
           {
+            if (number_packets-- == 0)
+              return(MagickFalse);
             pixel=(size_t) (*p++) << 8;
             pixel|=(*p++);
             for ( ; count != 0; count--)
             {
-              if (number_packets-- == 0)
-                return(MagickFalse);
               *q=(unsigned char) (pixel >> 8);
               *(q+1)=(unsigned char) pixel;
               q+=8;