From fcc1d412f3ba109b568777844803c612f084d518 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sun, 21 Jan 2018 18:37:46 -0500 Subject: [PATCH] Eliminate initialize file list Credit OSS Fuzz --- coders/vid.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/coders/vid.c b/coders/vid.c index 6493b4d8e..57ad0e4d8 100644 --- a/coders/vid.c +++ b/coders/vid.c @@ -100,6 +100,7 @@ static Image *ReadVIDImage(const ImageInfo *image_info,ExceptionInfo *exception) #define ClientName "montage" char + **list, **filelist, *label; @@ -139,12 +140,15 @@ static Image *ReadVIDImage(const ImageInfo *image_info,ExceptionInfo *exception) assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info,exception); - filelist=(char **) AcquireMagickMemory(sizeof(*filelist)); - if (filelist == (char **) NULL) + list=(char **) AcquireMagickMemory(sizeof(*filelist)); + if (list == (char **) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); - filelist[0]=ConstantString(image_info->filename); + list[0]=ConstantString(image_info->filename); + filelist=list; number_files=1; status=ExpandFilenames(&number_files,&filelist); + list[0]=DestroyString(list[0]); + list=(char **) RelinquishMagickMemory(list); if ((status == MagickFalse) || (number_files == 0)) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); image=DestroyImage(image); -- 2.40.0