From: Cristy Date: Fri, 29 Dec 2017 00:55:30 +0000 (-0500) Subject: Exit early on bad file descriptor X-Git-Tag: 7.0.7-19~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eacbdd623be13633c083fd2831eeb79e5381e089;p=imagemagick Exit early on bad file descriptor --- diff --git a/MagickCore/blob.c b/MagickCore/blob.c index f6a7384e1..917fc0bdc 100644 --- a/MagickCore/blob.c +++ b/MagickCore/blob.c @@ -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);