]> granicus.if.org Git - imagemagick/commitdiff
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6931
authorCristy <urban-warrior@imagemagick.org>
Fri, 16 Mar 2018 23:29:13 +0000 (19:29 -0400)
committerCristy <urban-warrior@imagemagick.org>
Fri, 16 Mar 2018 23:29:13 +0000 (19:29 -0400)
coders/mpeg.c

index 8a2999b1c129e0c69458122f502c8891bb6a2047..1b206f65a1e8e3454fc18ab0377b578afb7186bf 100644 (file)
@@ -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);