]> granicus.if.org Git - imagemagick/commitdiff
Exit early on bad file descriptor
authorCristy <urban-warrior@imagemagick.org>
Fri, 29 Dec 2017 00:55:30 +0000 (19:55 -0500)
committerCristy <urban-warrior@imagemagick.org>
Fri, 29 Dec 2017 00:55:30 +0000 (19:55 -0500)
MagickCore/blob.c

index f6a7384e14dff1e33584e37eb74dddfdea7abcea..917fc0bdc2a04604c96389e83dd17a9223072e6e 100644 (file)
@@ -3108,6 +3108,11 @@ MagickExport MagickBooleanType OpenBlob(const ImageInfo *image_info,
       *fileMode =(*type);
       fileMode[1]='\0';
       blob_info->file_info.file=fdopen(StringToLong(filename+3),fileMode);
+      if (blob_info->file_info.file == (FILE *) NULL)
+        {
+          ThrowFileException(exception,BlobError,"UnableToOpenBlob",filename);
+          return(MagickFalse);
+        }
 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)
       if (strchr(type,'b') != (char *) NULL)
         setmode(fileno(blob_info->file_info.file),_O_BINARY);