% October 1998 %
% %
% %
-% Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
-% http://www.imagemagick.org/script/license.php %
+% https://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
MagickStatusType
flags;
- PolicyDomain
- domain;
-
- PolicyRights
- rights;
-
/*
Determine image type from filename prefix or suffix (e.g. image.jpg).
*/
(void) SetImageInfo(read_info,0,exception);
(void) CopyMagickString(filename,read_info->filename,MagickPathExtent);
(void) CopyMagickString(magick,read_info->magick,MagickPathExtent);
- domain=CoderPolicyDomain;
- rights=ReadPolicyRights;
- if (IsRightsAuthorized(domain,rights,read_info->magick) == MagickFalse)
- {
- errno=EPERM;
- (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
- "NotAuthorized","`%s'",read_info->filename);
- read_info=DestroyImageInfo(read_info);
- return((Image *) NULL);
- }
/*
Call appropriate image reader based on image type.
*/
sans_exception=DestroyExceptionInfo(sans_exception);
if (magick_info != (const MagickInfo *) NULL)
{
+ PolicyDomain
+ domain;
+
+ PolicyRights
+ rights;
+
+ domain=CoderPolicyDomain;
+ rights=ReadPolicyRights;
+ if (IsRightsAuthorized(domain,rights,magick_info->module) == MagickFalse)
+ {
+ errno=EPERM;
+ (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
+ "NotAuthorized","`%s'",read_info->filename);
+ read_info=DestroyImageInfo(read_info);
+ return((Image *) NULL);
+ }
if (GetMagickEndianSupport(magick_info) == MagickFalse)
read_info->endian=UndefinedEndian;
else
}
}
if ((magick_info != (const MagickInfo *) NULL) &&
- (GetMagickSeekableStream(magick_info) != MagickFalse))
+ (GetMagickDecoderSeekableStream(magick_info) != MagickFalse))
{
MagickBooleanType
status;
const StringInfo
*profile;
+ ssize_t
+ option_type;
+
next->taint=MagickFalse;
GetPathComponent(magick_filename,MagickPath,magick_path);
if (*magick_path == '\0' && *next->magick == '\0')
flags=ParseGeometry(value,&geometry_info);
if (geometry_info.sigma != 0)
next->resolution.x=geometry_info.rho/geometry_info.sigma;
+ if (strchr(value,',') != (char *) NULL)
+ next->resolution.x=geometry_info.rho+geometry_info.sigma/1000.0;
(void) DeleteImageProperty(next,"exif:XResolution");
}
value=GetImageProperty(next,"exif:YResolution",exception);
flags=ParseGeometry(value,&geometry_info);
if (geometry_info.sigma != 0)
next->resolution.y=geometry_info.rho/geometry_info.sigma;
+ if (strchr(value,',') != (char *) NULL)
+ next->resolution.y=geometry_info.rho+geometry_info.sigma/1000.0;
(void) DeleteImageProperty(next,"exif:YResolution");
}
value=GetImageProperty(next,"tiff:ResolutionUnit",exception);
value=GetImageProperty(next,"exif:ResolutionUnit",exception);
if (value != (char *) NULL)
{
- next->units=(ResolutionType) (StringToLong(value)-1);
+ option_type=ParseCommandOption(MagickResolutionOptions,MagickFalse,
+ value);
+ if (option_type >= 0)
+ next->units=(ResolutionType) option_type;
(void) DeleteImageProperty(next,"exif:ResolutionUnit");
(void) DeleteImageProperty(next,"tiff:ResolutionUnit");
}
}
option=GetImageOption(image_info,"dispose");
if (option != (const char *) NULL)
- next->dispose=(DisposeType) ParseCommandOption(MagickDisposeOptions,
- MagickFalse,option);
+ {
+ option_type=ParseCommandOption(MagickDisposeOptions,MagickFalse,
+ option);
+ if (option_type >= 0)
+ next->dispose=(DisposeType) option_type;
+ }
if (read_info->verbose != MagickFalse)
(void) IdentifyImage(next,stderr,MagickFalse,exception);
image=next;
status,
temporary;
- PolicyDomain
- domain;
-
- PolicyRights
- rights;
-
/*
Determine image type from filename prefix or suffix (e.g. image.jpg).
*/
(void) CopyMagickString(filename,image->filename,MagickPathExtent);
(void) CopyMagickString(image->filename,write_info->filename,
MagickPathExtent);
- domain=CoderPolicyDomain;
- rights=WritePolicyRights;
- if (IsRightsAuthorized(domain,rights,write_info->magick) == MagickFalse)
- {
- sans_exception=DestroyExceptionInfo(sans_exception);
- write_info=DestroyImageInfo(write_info);
- errno=EPERM;
- ThrowBinaryException(PolicyError,"NotAuthorized",filename);
- }
/*
Call appropriate image writer based on image type.
*/
sans_exception=DestroyExceptionInfo(sans_exception);
if (magick_info != (const MagickInfo *) NULL)
{
+ PolicyDomain
+ domain;
+
+ PolicyRights
+ rights;
+
+ domain=CoderPolicyDomain;
+ rights=WritePolicyRights;
+ if (IsRightsAuthorized(domain,rights,magick_info->module) == MagickFalse)
+ {
+ write_info=DestroyImageInfo(write_info);
+ errno=EPERM;
+ ThrowBinaryException(PolicyError,"NotAuthorized",filename);
+ }
if (GetMagickEndianSupport(magick_info) == MagickFalse)
image->endian=UndefinedEndian;
else
status=MagickFalse;
temporary=MagickFalse;
if ((magick_info != (const MagickInfo *) NULL) &&
- (GetMagickSeekableStream(magick_info) != MagickFalse))
+ (GetMagickEncoderSeekableStream(magick_info) != MagickFalse))
{
char
image_filename[MagickPathExtent];