From 73aad72d1d28170b38014168f523d0ee2941c21e Mon Sep 17 00:00:00 2001 From: Cristy Date: Sun, 18 Mar 2018 12:41:46 -0400 Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6874 --- coders/rle.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); -- 2.40.0