From e74d2e1b72b535ba32e7af9e6426d2a18b94f69f Mon Sep 17 00:00:00 2001 From: Cristy Date: Wed, 26 Jul 2017 09:19:01 -0400 Subject: [PATCH] https://patch-diff.githubusercontent.com/raw/ImageMagick/ImageMagick/pull/622 --- coders/gif.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/coders/gif.c b/coders/gif.c index bbfd5b206..a08e5d95b 100644 --- a/coders/gif.c +++ b/coders/gif.c @@ -1109,10 +1109,11 @@ static Image *ReadGIFImage(const ImageInfo *image_info,ExceptionInfo *exception) loop=LocaleNCompare((char *) buffer,"NETSCAPE2.0",11) == 0 ? MagickTrue : MagickFalse; if (loop != MagickFalse) + while (ReadBlobBlock(image,buffer) != 0) { - while (ReadBlobBlock(image,buffer) != 0) - iterations=(size_t) ((buffer[2] << 8) | buffer[1]); - break; + iterations=(size_t) ((buffer[2] << 8) | buffer[1]); + if (iterations != 0) + iterations++; } else { @@ -1739,7 +1740,7 @@ static MagickBooleanType WriteGIFImage(const ImageInfo *image_info,Image *image, (void) WriteBlob(image,11,(unsigned char *) "NETSCAPE2.0"); (void) WriteBlobByte(image,(unsigned char) 0x03); (void) WriteBlobByte(image,(unsigned char) 0x01); - (void) WriteBlobLSBShort(image,(unsigned short) image->iterations); + (void) WriteBlobLSBShort(image,(unsigned short) (image->iterations ? image->iterations - 1 : 0)); (void) WriteBlobByte(image,(unsigned char) 0x00); } if ((image->gamma != 1.0f/2.2f)) -- 2.50.1