From: Cristy Date: Sun, 18 Mar 2018 16:41:46 +0000 (-0400) Subject: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6874 X-Git-Tag: 7.0.7-28~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73aad72d1d28170b38014168f523d0ee2941c21e;p=imagemagick https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6874 --- diff --git a/coders/rle.c b/coders/rle.c index 54a342191..03258073b 100644 --- a/coders/rle.c +++ b/coders/rle.c @@ -315,8 +315,11 @@ static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception) if (comment == (char *) NULL) ThrowRLEException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,length-1,(unsigned char *) comment); - comment[length-1]='\0'; - (void) SetImageProperty(image,"comment",comment,exception); + if (count == (length-1)) + { + comment[length-1]='\0'; + (void) SetImageProperty(image,"comment",comment,exception); + } comment=DestroyString(comment); if ((length & 0x01) == 0) (void) ReadBlobByte(image);