From 090906c759b234b0425238345d854aa3f0d7f0b6 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sun, 4 Feb 2018 15:49:44 -0500 Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5674 --- coders/tim.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coders/tim.c b/coders/tim.c index 1fe538919..f6d69f3ec 100644 --- a/coders/tim.c +++ b/coders/tim.c @@ -235,6 +235,8 @@ static Image *ReadTIMImage(const ImageInfo *image_info,ExceptionInfo *exception) width=ReadBlobLSBShort(image); height=ReadBlobLSBShort(image); image_size=2*width*height; + if (image_size > GetBlobSize(image)) + ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); bytes_per_line=width*2; width=(width*16)/bits_per_pixel; tim_pixels=(unsigned char *) AcquireQuantumMemory(image_size, @@ -458,6 +460,7 @@ ModuleExport size_t RegisterTIMImage(void) entry=AcquireMagickInfo("TIM","TIM","PSX TIM"); entry->decoder=(DecodeImageHandler *) ReadTIMImage; + entry->flags|=CoderDecoderSeekableStreamFlag; (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } -- 2.40.0