From 219b8b6f9fced421ced5d1a566b961cadd4dcfba Mon Sep 17 00:00:00 2001 From: Cristy Date: Fri, 16 Mar 2018 19:29:13 -0400 Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6931 --- coders/mpeg.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/coders/mpeg.c b/coders/mpeg.c index 8a2999b1c..1b206f65a 100644 --- a/coders/mpeg.c +++ b/coders/mpeg.c @@ -201,20 +201,25 @@ static Image *ReadMPEGImage(const ImageInfo *image_info, /* Convert MPEG to PAM with delegate. */ + images=(Image *) NULL; read_info=CloneImageInfo(image_info); image=AcquireImage(image_info,exception); - (void) InvokeDelegate(read_info,image,"mpeg:decode",(char *) NULL,exception); - (void) FormatLocaleString(read_info->filename,MagickPathExtent,"%s.%s", - read_info->unique,ReadMPEGIntermediateFormat); - *read_info->magick='\0'; - images=ReadImage(read_info,exception); - if (images != (Image *) NULL) - for (next=images; next != (Image *) NULL; next=next->next) + status=InvokeDelegate(read_info,image,"mpeg:decode",(char *) NULL,exception); + if (status != MagickFalse) { - (void) CopyMagickString(next->filename,image->filename,MagickPathExtent); - (void) CopyMagickString(next->magick,image->magick,MagickPathExtent); + (void) FormatLocaleString(read_info->filename,MagickPathExtent,"%s.%s", + read_info->unique,ReadMPEGIntermediateFormat); + *read_info->magick='\0'; + images=ReadImage(read_info,exception); + if (images != (Image *) NULL) + for (next=images; next != (Image *) NULL; next=next->next) + { + (void) CopyMagickString(next->filename,image->filename, + MagickPathExtent); + (void) CopyMagickString(next->magick,image->magick,MagickPathExtent); + } + (void) RelinquishUniqueFileResource(read_info->filename); } - (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); image=DestroyImage(image); return(images); -- 2.40.0