This commit is contained in:
Cristy
2018-07-21 16:46:40 -04:00
parent 856599a371
commit 568da17ae8
2 changed files with 24 additions and 0 deletions
+19
View File
@@ -1382,6 +1382,14 @@ MagickExport void *FileToBlob(const char *filename,const size_t extent,
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
assert(exception != (ExceptionInfo *) NULL);
*length=0;
status=IsRightsAuthorized(PathPolicyDomain,ReadPolicyRights,filename);
if (status == MagickFalse)
{
errno=EPERM;
(void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
"NotAuthorized","`%s'",filename);
return(NULL);
}
status=GetPathAttributes(filename,&attributes);
if ((status == MagickFalse) || (S_ISDIR(attributes.st_mode) != 0))
{
@@ -1568,6 +1576,9 @@ MagickExport MagickBooleanType FileToImage(Image *image,const char *filename,
int
file;
MagickBooleanType
*status;
size_t
length,
quantum;
@@ -1585,6 +1596,14 @@ MagickExport MagickBooleanType FileToImage(Image *image,const char *filename,
assert(image->signature == MagickCoreSignature);
assert(filename != (const char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
status=IsRightsAuthorized(PathPolicyDomain,WritePolicyRights,filename);
if (status == MagickFalse)
{
errno=EPERM;
(void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
"NotAuthorized","`%s'",filename);
return(MagickFalse);
}
file=fileno(stdin);
if (LocaleCompare(filename,"-") != 0)
file=open_utf8(filename,O_RDONLY | O_BINARY,0);
+5
View File
@@ -231,6 +231,11 @@ static Image *ReadMVGImage(const ImageInfo *image_info,ExceptionInfo *exception)
draw_info=DestroyDrawInfo(draw_info);
return(DestroyImageList(image));
}
if (*draw_info->primitive == '@')
{
draw_info=DestroyDrawInfo(draw_info);
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}
(void) DrawImage(image,draw_info,exception);
(void) SetImageArtifact(image,"MVG",draw_info->primitive);
draw_info=DestroyDrawInfo(draw_info);