* Prevent random pixel data for corrupt JPEG image (bug report from
Hirokazu Moriguchi, Sony).
* Restore -mattecolor option.
+ * Support pixel-cache and shred security policies.
2017-02-14 7.0.4-9 Cristy <quetzlzacatenango@image...>
* Release ImageMagick version 7.0.4-9, GIT revision 19580:d474b37:20170214.
cache_info->metacontent_extent);
if ((status != MagickFalse) && (length == (MagickSizeType) ((size_t) length)))
{
+ static ssize_t
+ anonymous_pixel_cache = (-1);
+
+ if (anonymous_pixel_cache < 0)
+ {
+ char
+ *value;
+
+ /*
+ Does the security policy require anonymous mapping for pixel cache?
+ */
+ anonymous_pixel_cache=0;
+ value=GetPolicyValue("pixel-cache");
+ if (LocaleCompare(value,"anonymous") == 0)
+ anonymous_pixel_cache=1;
+ value=DestroyString(value);
+ }
status=AcquireMagickResource(MemoryResource,cache_info->length);
if (((cache_info->type == UndefinedCache) && (status != MagickFalse)) ||
(cache_info->type == MemoryCache))
{
status=MagickTrue;
- cache_info->mapped=MagickFalse;
- cache_info->pixels=(Quantum *) MagickAssumeAligned(
- AcquireAlignedMemory(1,(size_t) cache_info->length));
+ if (anonymous_pixel_cache == 0)
+ {
+ cache_info->mapped=MagickFalse;
+ cache_info->pixels=(Quantum *) MagickAssumeAligned(
+ AcquireAlignedMemory(1,(size_t) cache_info->length));
+ }
+ else
+ {
+ cache_info->mapped=MagickTrue;
+ cache_info->pixels=(Quantum *) MapBlob(-1,IOMode,0,(size_t)
+ cache_info->length);
+ }
if (cache_info->pixels == (Quantum *) NULL)
cache_info->pixels=source_info.pixels;
else
if ((path == (const char *) NULL) || (*path == '\0'))
return(MagickFalse);
- passes=GetEnvironmentValue("MAGICK_SHRED_PASSES");
+ passes=GetPolicyValue("shred");
+ if (passes == (char *) NULL)
+ passes=GetEnvironmentValue("MAGICK_SHRED_PASSES");
if (passes == (char *) NULL)
{
/*
<!-- <policy domain="resource" name="throttle" value="0"/> -->
<!-- <policy domain="resource" name="time" value="3600"/> -->
<!-- <policy domain="system" name="precision" value="6"/> -->
+ <!-- <policy domain="system" name="pixel-cache" value="anonymous"/> -->
+ <!-- <policy domain="system" name="shred" value="2"/> -->
<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
<!-- <policy domain="delegate" rights="none" pattern="HTTPS" /> -->
<!-- <policy domain="path" rights="none" pattern="@*" /> -->