MagickOffsetType
width,
height,
+ list_length,
area,
memory,
map,
MagickSizeType
width_limit,
height_limit,
+ list_length_limit,
area_limit,
memory_limit,
map_limit,
{
MagickULLConstant(0), /* initial width */
MagickULLConstant(0), /* initial height */
+ MagickULLConstant(0), /* initial list length */
MagickULLConstant(0), /* initial area */
MagickULLConstant(0), /* initial memory */
MagickULLConstant(0), /* initial map */
MagickULLConstant(0), /* initial time */
(INT_MAX/(5*sizeof(Quantum))), /* width limit */
(INT_MAX/(5*sizeof(Quantum))), /* height limit */
+ MagickResourceInfinity, /* list length limit */
MagickULLConstant(3072)*1024*1024, /* area limit */
MagickULLConstant(1536)*1024*1024, /* memory limit */
MagickULLConstant(3072)*1024*1024, /* map limit */
}
break;
}
- case MemoryResource:
- {
- if ((resource_info.memory+(MagickOffsetType) size) < 0)
- return(MagickFalse);
- resource_info.memory+=(MagickOffsetType) size;
- limit=resource_info.memory_limit;
- if ((limit == MagickResourceInfinity) ||
- (resource_info.memory < (MagickOffsetType) limit))
- status=MagickTrue;
- else
- resource_info.memory-=(MagickOffsetType) size;
- if (logging != MagickFalse)
- {
- (void) FormatMagickSize(size,MagickTrue,"B",MagickFormatExtent,
- resource_request);
- (void) FormatMagickSize((MagickSizeType) resource_info.memory,
- MagickTrue,"B",MagickFormatExtent,resource_current);
- (void) FormatMagickSize(limit,MagickTrue,"B",MagickFormatExtent,
- resource_limit);
- }
- break;
- }
- case MapResource:
- {
- if ((resource_info.map+(MagickOffsetType) size) < 0)
- return(MagickFalse);
- resource_info.map+=(MagickOffsetType) size;
- limit=resource_info.map_limit;
- if ((limit == MagickResourceInfinity) ||
- (resource_info.map < (MagickOffsetType) limit))
- status=MagickTrue;
- else
- resource_info.map-=(MagickOffsetType) size;
- if (logging != MagickFalse)
- {
- (void) FormatMagickSize(size,MagickTrue,"B",MagickFormatExtent,
- resource_request);
- (void) FormatMagickSize((MagickSizeType) resource_info.map,
- MagickTrue,"B",MagickFormatExtent,resource_current);
- (void) FormatMagickSize(limit,MagickTrue,"B",MagickFormatExtent,
- resource_limit);
- }
- break;
- }
case DiskResource:
{
if ((resource_info.disk+(MagickOffsetType) size) < 0)
}
break;
}
+ case MapResource:
+ {
+ if ((resource_info.map+(MagickOffsetType) size) < 0)
+ return(MagickFalse);
+ resource_info.map+=(MagickOffsetType) size;
+ limit=resource_info.map_limit;
+ if ((limit == MagickResourceInfinity) ||
+ (resource_info.map < (MagickOffsetType) limit))
+ status=MagickTrue;
+ else
+ resource_info.map-=(MagickOffsetType) size;
+ if (logging != MagickFalse)
+ {
+ (void) FormatMagickSize(size,MagickTrue,"B",MagickFormatExtent,
+ resource_request);
+ (void) FormatMagickSize((MagickSizeType) resource_info.map,
+ MagickTrue,"B",MagickFormatExtent,resource_current);
+ (void) FormatMagickSize(limit,MagickTrue,"B",MagickFormatExtent,
+ resource_limit);
+ }
+ break;
+ }
+ case ListLengthResource:
+ {
+ resource_info.list_length=(MagickOffsetType) size;
+ limit=resource_info.list_length_limit;
+ if ((limit == MagickResourceInfinity) || (size < limit))
+ status=MagickTrue;
+ if (logging != MagickFalse)
+ {
+ (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
+ MagickFormatExtent,resource_request);
+ (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
+ MagickFormatExtent,resource_current);
+ (void) FormatMagickSize(limit,MagickFalse,(const char *) NULL,
+ MagickFormatExtent,resource_limit);
+ }
+ break;
+ }
+ case MemoryResource:
+ {
+ if ((resource_info.memory+(MagickOffsetType) size) < 0)
+ return(MagickFalse);
+ resource_info.memory+=(MagickOffsetType) size;
+ limit=resource_info.memory_limit;
+ if ((limit == MagickResourceInfinity) ||
+ (resource_info.memory < (MagickOffsetType) limit))
+ status=MagickTrue;
+ else
+ resource_info.memory-=(MagickOffsetType) size;
+ if (logging != MagickFalse)
+ {
+ (void) FormatMagickSize(size,MagickTrue,"B",MagickFormatExtent,
+ resource_request);
+ (void) FormatMagickSize((MagickSizeType) resource_info.memory,
+ MagickTrue,"B",MagickFormatExtent,resource_current);
+ (void) FormatMagickSize(limit,MagickTrue,"B",MagickFormatExtent,
+ resource_limit);
+ }
+ break;
+ }
case ThreadResource:
{
limit=resource_info.thread_limit;
LockSemaphoreInfo(resource_semaphore);
switch (type)
{
- case WidthResource:
+ case AreaResource:
{
- resource=(MagickSizeType) resource_info.width;
+ resource=(MagickSizeType) resource_info.area;
break;
}
- case HeightResource:
+ case DiskResource:
{
- resource=(MagickSizeType) resource_info.height;
+ resource=(MagickSizeType) resource_info.disk;
break;
}
- case AreaResource:
+ case FileResource:
{
- resource=(MagickSizeType) resource_info.area;
+ resource=(MagickSizeType) resource_info.file;
break;
}
- case MemoryResource:
+ case HeightResource:
{
- resource=(MagickSizeType) resource_info.memory;
+ resource=(MagickSizeType) resource_info.height;
break;
}
- case MapResource:
+ case ListLengthResource:
{
- resource=(MagickSizeType) resource_info.map;
+ resource=(MagickSizeType) resource_info.list_length;
break;
}
- case DiskResource:
+ case MapResource:
{
- resource=(MagickSizeType) resource_info.disk;
+ resource=(MagickSizeType) resource_info.map;
break;
}
- case FileResource:
+ case MemoryResource:
{
- resource=(MagickSizeType) resource_info.file;
+ resource=(MagickSizeType) resource_info.memory;
break;
}
case ThreadResource:
resource=(MagickSizeType) resource_info.time;
break;
}
+ case WidthResource:
+ {
+ resource=(MagickSizeType) resource_info.width;
+ break;
+ }
default:
break;
}
LockSemaphoreInfo(resource_semaphore);
switch (type)
{
- case WidthResource:
+ case AreaResource:
{
- resource=resource_info.width_limit;
+ resource=resource_info.area_limit;
break;
}
- case HeightResource:
+ case DiskResource:
{
- resource=resource_info.height_limit;
+ resource=resource_info.disk_limit;
break;
}
- case AreaResource:
+ case FileResource:
{
- resource=resource_info.area_limit;
+ resource=resource_info.file_limit;
break;
}
- case MemoryResource:
+ case HeightResource:
{
- resource=resource_info.memory_limit;
+ resource=resource_info.height_limit;
break;
}
- case MapResource:
+ case ListLengthResource:
{
- resource=resource_info.map_limit;
+ resource=resource_info.list_length_limit;
break;
}
- case DiskResource:
+ case MemoryResource:
{
- resource=resource_info.disk_limit;
+ resource=resource_info.memory_limit;
break;
}
- case FileResource:
+ case MapResource:
{
- resource=resource_info.file_limit;
+ resource=resource_info.map_limit;
break;
}
case ThreadResource:
resource=resource_info.time_limit;
break;
}
+ case WidthResource:
+ {
+ resource=resource_info.width_limit;
+ break;
+ }
default:
break;
}
area_limit[MagickFormatExtent],
disk_limit[MagickFormatExtent],
height_limit[MagickFormatExtent],
+ list_length_limit[MagickFormatExtent],
map_limit[MagickFormatExtent],
memory_limit[MagickFormatExtent],
time_limit[MagickFormatExtent],
MagickFormatExtent,width_limit);
(void) FormatMagickSize(resource_info.height_limit,MagickFalse,"P",
MagickFormatExtent,height_limit);
+ (void) FormatMagickSize(resource_info.list_length_limit,MagickFalse,"P",
+ MagickFormatExtent,list_length_limit);
(void) FormatMagickSize(resource_info.area_limit,MagickFalse,"P",
MagickFormatExtent,area_limit);
(void) FormatMagickSize(resource_info.memory_limit,MagickTrue,"B",
(void) FormatLocaleFile(file,"Resource limits:\n");
(void) FormatLocaleFile(file," Width: %s\n",width_limit);
(void) FormatLocaleFile(file," Height: %s\n",height_limit);
+ (void) FormatLocaleFile(file," List length: %s\n",list_length_limit);
(void) FormatLocaleFile(file," Area: %s\n",area_limit);
(void) FormatLocaleFile(file," Memory: %s\n",memory_limit);
(void) FormatLocaleFile(file," Map: %s\n",map_limit);
}
break;
}
- case MemoryResource:
- {
- resource_info.memory-=size;
- assert(resource_info.memory >= 0);
- if (logging != MagickFalse)
- {
- (void) FormatMagickSize(size,MagickFalse,"B",MagickFormatExtent,
- resource_request);
- (void) FormatMagickSize((MagickSizeType) resource_info.memory,
- MagickTrue,"B",MagickFormatExtent,resource_current);
- (void) FormatMagickSize(resource_info.memory_limit,MagickTrue,"B",
- MagickFormatExtent,resource_limit);
- }
- break;
- }
- case MapResource:
- {
- resource_info.map-=size;
- assert(resource_info.map >= 0);
- if (logging != MagickFalse)
- {
- (void) FormatMagickSize(size,MagickFalse,"B",MagickFormatExtent,
- resource_request);
- (void) FormatMagickSize((MagickSizeType) resource_info.map,
- MagickTrue,"B",MagickFormatExtent,resource_current);
- (void) FormatMagickSize(resource_info.map_limit,MagickTrue,"B",
- MagickFormatExtent,resource_limit);
- }
- break;
- }
case DiskResource:
{
resource_info.disk-=size;
}
break;
}
+ case ListLengthResource:
+ {
+ resource_info.list_length=(MagickOffsetType) size;
+ if (logging != MagickFalse)
+ {
+ (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
+ MagickFormatExtent,resource_request);
+ (void) FormatMagickSize((MagickSizeType) resource_info.list_length,
+ MagickFalse,(const char *) NULL,MagickFormatExtent,
+ resource_current);
+ (void) FormatMagickSize(resource_info.list_length_limit,MagickFalse,
+ (const char *) NULL,MagickFormatExtent,resource_limit);
+ }
+ break;
+ }
+ case MapResource:
+ {
+ resource_info.map-=size;
+ assert(resource_info.map >= 0);
+ if (logging != MagickFalse)
+ {
+ (void) FormatMagickSize(size,MagickFalse,"B",MagickFormatExtent,
+ resource_request);
+ (void) FormatMagickSize((MagickSizeType) resource_info.map,
+ MagickTrue,"B",MagickFormatExtent,resource_current);
+ (void) FormatMagickSize(resource_info.map_limit,MagickTrue,"B",
+ MagickFormatExtent,resource_limit);
+ }
+ break;
+ }
+ case MemoryResource:
+ {
+ resource_info.memory-=size;
+ assert(resource_info.memory >= 0);
+ if (logging != MagickFalse)
+ {
+ (void) FormatMagickSize(size,MagickFalse,"B",MagickFormatExtent,
+ resource_request);
+ (void) FormatMagickSize((MagickSizeType) resource_info.memory,
+ MagickTrue,"B",MagickFormatExtent,resource_current);
+ (void) FormatMagickSize(resource_info.memory_limit,MagickTrue,"B",
+ MagickFormatExtent,resource_limit);
+ }
+ break;
+ }
case ThreadResource:
{
if (logging != MagickFalse)
100.0));
limit=DestroyString(limit);
}
+ limit=GetEnvironmentValue("MAGICK_LIST_LENGTH_LIMIT");
+ if (limit != (char *) NULL)
+ {
+ (void) SetMagickResourceLimit(ListLengthResource,
+ StringToMagickSizeType(limit,100.0));
+ limit=DestroyString(limit);
+ }
return(MagickTrue);
}
\f
value=(char *) NULL;
switch (type)
{
- case WidthResource:
+ case AreaResource:
{
- resource_info.width_limit=limit;
- value=GetPolicyValue("resource:width");
+ resource_info.area_limit=limit;
+ value=GetPolicyValue("resource:area");
if (value != (char *) NULL)
- resource_info.width_limit=MagickMin(limit,StringToMagickSizeType(value,
+ resource_info.area_limit=MagickMin(limit,StringToMagickSizeType(value,
100.0));
break;
}
- case HeightResource:
+ case DiskResource:
{
- resource_info.height_limit=limit;
- value=GetPolicyValue("resource:height");
+ resource_info.disk_limit=limit;
+ value=GetPolicyValue("resource:disk");
if (value != (char *) NULL)
- resource_info.height_limit=MagickMin(limit,StringToMagickSizeType(
- value,100.0));
+ resource_info.disk_limit=MagickMin(limit,StringToMagickSizeType(value,
+ 100.0));
break;
}
- case AreaResource:
+ case FileResource:
{
- resource_info.area_limit=limit;
- value=GetPolicyValue("resource:area");
+ resource_info.file_limit=limit;
+ value=GetPolicyValue("resource:file");
if (value != (char *) NULL)
- resource_info.area_limit=MagickMin(limit,StringToMagickSizeType(value,
+ resource_info.file_limit=MagickMin(limit,StringToMagickSizeType(value,
100.0));
break;
}
- case MemoryResource:
+ case HeightResource:
{
- resource_info.memory_limit=limit;
- value=GetPolicyValue("resource:memory");
+ resource_info.height_limit=limit;
+ value=GetPolicyValue("resource:height");
if (value != (char *) NULL)
- resource_info.memory_limit=MagickMin(limit,StringToMagickSizeType(
+ resource_info.height_limit=MagickMin(limit,StringToMagickSizeType(
value,100.0));
break;
}
- case MapResource:
+ case ListLengthResource:
{
- resource_info.map_limit=limit;
- value=GetPolicyValue("resource:map");
+ resource_info.list_length_limit=limit;
+ value=GetPolicyValue("resource:list-length");
if (value != (char *) NULL)
- resource_info.map_limit=MagickMin(limit,StringToMagickSizeType(value,
- 100.0));
+ resource_info.list_length_limit=MagickMin(limit,
+ StringToMagickSizeType(value,100.0));
break;
}
- case DiskResource:
+ case MapResource:
{
- resource_info.disk_limit=limit;
- value=GetPolicyValue("resource:disk");
+ resource_info.map_limit=limit;
+ value=GetPolicyValue("resource:map");
if (value != (char *) NULL)
- resource_info.disk_limit=MagickMin(limit,StringToMagickSizeType(value,
- 100.0));
+ resource_info.map_limit=MagickMin(limit,StringToMagickSizeType(
+ value,100.0));
break;
}
- case FileResource:
+ case MemoryResource:
{
- resource_info.file_limit=limit;
- value=GetPolicyValue("resource:file");
+ resource_info.memory_limit=limit;
+ value=GetPolicyValue("resource:memory");
if (value != (char *) NULL)
- resource_info.file_limit=MagickMin(limit,StringToMagickSizeType(value,
- 100.0));
+ resource_info.memory_limit=MagickMin(limit,StringToMagickSizeType(
+ value,100.0));
break;
}
case ThreadResource:
ResetPixelCacheEpoch();
break;
}
+ case WidthResource:
+ {
+ resource_info.width_limit=limit;
+ value=GetPolicyValue("resource:width");
+ if (value != (char *) NULL)
+ resource_info.width_limit=MagickMin(limit,StringToMagickSizeType(value,
+ 100.0));
+ break;
+ }
default:
+ {
status=MagickFalse;
break;
+ }
}
if (value != (char *) NULL)
value=DestroyString(value);