Main GraphicsMagick source repository
Revision | 121de89bed951639c7d1c2b6bb2350bc1c6e7e9a (tree) |
---|---|
Time | 2022-01-09 08:14:10 |
Author | Bob Friesenhahn <bfriesen@Grap...> |
Commiter | Bob Friesenhahn |
Added support for a Read resource limit.
@@ -1,3 +1,13 @@ | ||
1 | +2022-01-08 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> | |
2 | + | |
3 | + * magick/resource.c: Add support for setting a read resource limit | |
4 | + via the MAGICK_LIMIT_READ environment variable, or similar to | |
5 | + '-limit read 5mb'. | |
6 | + | |
7 | + * magick/resource.h: Added a ReadResource limit, which is a limit | |
8 | + on how many uncompressed file bytes may be read while decoding an | |
9 | + input file. | |
10 | + | |
1 | 11 | 2022-01-01 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> |
2 | 12 | |
3 | 13 | * ChangeLog.2021: Rotate ChangeLog for 2022. Happy New Year! |
@@ -10,5 +10,5 @@ | ||
10 | 10 | |
11 | 11 | #define public MagickPackageName "GraphicsMagick" |
12 | 12 | #define public MagickPackageVersion "1.4" |
13 | -#define public MagickPackageVersionAddendum ".020220101" | |
14 | -#define public MagickPackageReleaseDate "snapshot-20220101" | |
13 | +#define public MagickPackageVersionAddendum ".020220108" | |
14 | +#define public MagickPackageReleaseDate "snapshot-20220108" |
@@ -195,6 +195,16 @@ | ||
195 | 195 | number of pixels due to multiple image frames/pages (e.g. multi-page |
196 | 196 | document or an animation).</abs> |
197 | 197 | |
198 | +<opt>MAGICK_LIMIT_READ</opt> | |
199 | + | |
200 | +<abs>Maximum number of uncompressed bytes which may be read while | |
201 | +decoding an image. Each read by the software from the input file is | |
202 | +counted against the total, even if it has been read before. Decoding | |
203 | +fails when the limit is reached. This limit helps defend against | |
204 | +highly compressed files (e.g. via gzip), or files which use complex | |
205 | +looping structures, or when data is being read from a stream | |
206 | +(pipe).</abs> | |
207 | + | |
198 | 208 | <opt>MAGICK_LIMIT_WIDTH</opt> |
199 | 209 | |
200 | 210 | <abs>Maximum pixel width of an image read, or created.</abs> |
@@ -3210,30 +3210,45 @@ | ||
3210 | 3210 | <utils apps=animate,compare,composite,convert,display,identify,import,mogrify,montage> |
3211 | 3211 | <dopt>-limit <type> <value></opt> |
3212 | 3212 | |
3213 | -<abs>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</abs> | |
3213 | +<abs>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</abs> | |
3214 | 3214 | |
3215 | 3215 | <pp> |
3216 | 3216 | By default, resource limits are estimated based on the available |
3217 | -resources of the system. The resource limits are <s>Disk</s>, maximum | |
3218 | -total disk space consumed; <s>File</s>, maximum number of file | |
3219 | -descriptors allowed to be open at once; <s>Map</s>, maximum total | |
3220 | -number of file bytes which may be memory mapped; <s>Memory</s>, | |
3221 | -maximum total number of bytes of heap memory used for image storage; | |
3222 | -<s>Pixels</s>, maximum absolute image size (per image); <s>Width</s>, | |
3223 | -maximum image pixels width; <s>Height</s>, maximum image pixels | |
3224 | -height; and <s>Threads</s>, the maximum number of worker threads to | |
3225 | -use per OpenMP thread team.</pp> | |
3226 | - | |
3227 | -<pp> | |
3228 | -These resource limits are used to decide if (for a given image) the | |
3229 | -decoded image ("pixel cache") should be stored in heap memory (RAM), | |
3230 | -in a memory-mapped disk file, or in a disk file accessed via | |
3231 | -read/write I/O. The number of total pixels in one image, and/or the | |
3232 | -width/height, may also be limited in order to force the reading, or | |
3233 | -creation of images larger than the limit (in pixels) to intentionally | |
3234 | -fail. The disk limit establishes an overall limit since using the disk | |
3235 | -is the means of last resort. When the disk limit has been reached, no | |
3236 | -more images may be read.</pp> | |
3217 | +resources and capabilities of the system. The resource limits are | |
3218 | +<s>Disk</s>, maximum total disk space consumed; <s>File</s>, maximum | |
3219 | +number of file descriptors allowed to be open at once; <s>Map</s>, | |
3220 | +maximum total number of file bytes which may be memory mapped; | |
3221 | +<s>Memory</s>, maximum total number of bytes of heap memory used for | |
3222 | +image storage; <s>Pixels</s>, maximum absolute image size (per image); | |
3223 | +<s>Width</s>, maximum image pixels width; <s>Height</s>, maximum image | |
3224 | +pixels height; <s>Read</s>, maximum number of uncompressed bytes to | |
3225 | +read; and <s>Threads</s>, the maximum number of worker threads to use | |
3226 | +per OpenMP thread team.</pp> | |
3227 | + | |
3228 | +<pp> | |
3229 | +The <s>Disk</s> and <s>Map</s> resource limits are used to decide if | |
3230 | +(for a given image) the decoded image ("pixel cache") should be stored | |
3231 | +in heap memory (RAM), in a memory-mapped disk file, or in a disk file | |
3232 | +accessed via read/write I/O.</pp> | |
3233 | + | |
3234 | +<pp> | |
3235 | +The number of total pixels in one image (<s>Pixels</s>), and/or the | |
3236 | +width/height (<s>Width</s>/<s>Height</s>), may be limited in order to | |
3237 | +force the reading, or creation of images larger than the limit (in | |
3238 | +pixels) to intentionally fail. The disk limit (<s>Disk</s>) | |
3239 | +establishes an overall limit since using the disk is the means of last | |
3240 | +resort. When the disk limit has been reached, no more images may be | |
3241 | +read.</pp> | |
3242 | + | |
3243 | +<pp> | |
3244 | +The amount of uncompressed data read when reading one image may be | |
3245 | +limited by the <s>Read</s> limit. Reading the image fails when the | |
3246 | +limit is hit. This option is useful if the data is read from a stream | |
3247 | +(pipe) or from a compressed file such as a gzipped file. Some files | |
3248 | +are very compressable and so a small compressed file can decompress to | |
3249 | +a huge amount of data. This option also defends against files which | |
3250 | +produce seemingly endless loops while decoding by seeking backwards in | |
3251 | +the file.</pp> | |
3237 | 3252 | |
3238 | 3253 | <pp> |
3239 | 3254 | The value argument is an absolute value, but may have standard binary |
@@ -3249,10 +3264,11 @@ | ||
3249 | 3264 | environment variables <s>MAGICK_LIMIT_DISK</s>, |
3250 | 3265 | <s>MAGICK_LIMIT_FILES</s>, <s>MAGICK_LIMIT_MAP</s>, |
3251 | 3266 | <s>MAGICK_LIMIT_MEMORY</s>, <s>MAGICK_LIMIT_PIXELS</s>, |
3252 | -<s>MAGICK_LIMIT_WIDTH</s>, <s>MAGICK_LIMIT_HEIGHT</s>,and | |
3253 | -<s>OMP_NUM_THREADS</s> may be used to set the limits for disk space, | |
3254 | -open files, memory mapped size, heap memory, per-image pixels, image | |
3255 | -width, image height, and threads respectively.</pp> | |
3267 | +<s>MAGICK_LIMIT_WIDTH</s>, <s>MAGICK_LIMIT_HEIGHT</s>. | |
3268 | +<s>MAGICK_LIMIT_READ</s>, and <s>OMP_NUM_THREADS</s> may be used to | |
3269 | +set the limits for disk space, open files, memory mapped size, heap | |
3270 | +memory, per-image pixels, image width, image height, and threads | |
3271 | +respectively.</pp> | |
3256 | 3272 | |
3257 | 3273 | <pp> |
3258 | 3274 | Use the option <tt>-list resource</tt> list the current limits.</pp> |
@@ -22,6 +22,7 @@ | ||
22 | 22 | MagickLib::SetMagickResourceLimit(MagickLib::WidthResource, 2048); |
23 | 23 | MagickLib::SetMagickResourceLimit(MagickLib::HeightResource, 2048); |
24 | 24 | MagickLib::SetMagickResourceLimit(MagickLib::DiskResource, 0); |
25 | + MagickLib::SetMagickResourceLimit(MagickLib::ReadResource, 900000); | |
25 | 26 | } |
26 | 27 | }; |
27 | 28 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | -% Copyright (C) 2003 - 2021 GraphicsMagick Group | |
2 | +% Copyright (C) 2003 - 2022 GraphicsMagick Group | |
3 | 3 | % Copyright (C) 2002 ImageMagick Studio |
4 | 4 | % Copyright 1991-1999 E. I. du Pont de Nemours and Company |
5 | 5 | % |
@@ -104,6 +104,8 @@ | ||
104 | 104 | block_size, /* I/O block size */ |
105 | 105 | length, /* The current size of the BLOB data. */ |
106 | 106 | extent, /* The amount of backing store currently allocated */ |
107 | + read_limit, /* Limit on data to return to user */ | |
108 | + read_total, /* Amount of data read thus far */ | |
107 | 109 | quantum; /* The amount by which to increase the size of the backing store */ |
108 | 110 | |
109 | 111 | unsigned int |
@@ -269,10 +271,11 @@ | ||
269 | 271 | return 0; |
270 | 272 | } |
271 | 273 | *data=(void *)(blob->data+blob->offset); |
272 | - available=Min(length,blob->length-blob->offset); | |
274 | + available=Min(Min(length,blob->read_limit-blob->read_total),blob->length-blob->offset); | |
273 | 275 | blob->offset+=available; |
274 | - if (available < length) | |
276 | + if (available == 0) | |
275 | 277 | blob->eof=True; |
278 | + blob->read_total += available; | |
276 | 279 | return available; |
277 | 280 | } |
278 | 281 |
@@ -1318,38 +1321,41 @@ | ||
1318 | 1321 | assert(image->blob != (BlobInfo *) NULL); |
1319 | 1322 | assert(image->blob->type != UndefinedStream); |
1320 | 1323 | blob=image->blob; |
1321 | - switch (blob->type) | |
1322 | - { | |
1323 | - case UndefinedStream: | |
1324 | - break; | |
1325 | - case FileStream: | |
1326 | - case StandardStream: | |
1327 | - case PipeStream: | |
1324 | + if (!blob->eof) | |
1328 | 1325 | { |
1329 | - blob->eof=feof(blob->handle.std); | |
1330 | - break; | |
1331 | - } | |
1332 | - case ZipStream: | |
1333 | - { | |
1326 | + switch (blob->type) | |
1327 | + { | |
1328 | + case UndefinedStream: | |
1329 | + break; | |
1330 | + case FileStream: | |
1331 | + case StandardStream: | |
1332 | + case PipeStream: | |
1333 | + { | |
1334 | + blob->eof=feof(blob->handle.std); | |
1335 | + break; | |
1336 | + } | |
1337 | + case ZipStream: | |
1338 | + { | |
1334 | 1339 | #if defined(HasZLIB) && !defined(DISABLE_COMPRESSED_FILES) |
1335 | - blob->eof=gzeof(blob->handle.gz); | |
1340 | + blob->eof=gzeof(blob->handle.gz); | |
1336 | 1341 | #endif /* defined(HasZLIB) && !defined(DISABLE_COMPRESSED_FILES) */ |
1337 | - break; | |
1338 | - } | |
1339 | - case BZipStream: | |
1340 | - { | |
1342 | + break; | |
1343 | + } | |
1344 | + case BZipStream: | |
1345 | + { | |
1341 | 1346 | #if defined(HasBZLIB) && !defined(DISABLE_COMPRESSED_FILES) |
1342 | - int | |
1343 | - status; | |
1344 | - | |
1345 | - (void) BZ2_bzerror(blob->handle.bz,&status); | |
1346 | - blob->eof=status == BZ_UNEXPECTED_EOF; | |
1347 | + int | |
1348 | + status; | |
1349 | + | |
1350 | + (void) BZ2_bzerror(blob->handle.bz,&status); | |
1351 | + blob->eof=status == BZ_UNEXPECTED_EOF; | |
1347 | 1352 | #endif /* defined(HasBZLIB) && !defined(DISABLE_COMPRESSED_FILES) */ |
1348 | - break; | |
1353 | + break; | |
1354 | + } | |
1355 | + case BlobStream: | |
1356 | + break; | |
1357 | + } | |
1349 | 1358 | } |
1350 | - case BlobStream: | |
1351 | - break; | |
1352 | - } | |
1353 | 1359 | return(blob->eof); |
1354 | 1360 | } |
1355 | 1361 |
@@ -2387,7 +2393,8 @@ | ||
2387 | 2393 | |
2388 | 2394 | size_t |
2389 | 2395 | block_size, |
2390 | - length; | |
2396 | + length, | |
2397 | + total=0; | |
2391 | 2398 | |
2392 | 2399 | assert(image != (Image *) NULL); |
2393 | 2400 | assert(image->signature == MagickSignature); |
@@ -2421,6 +2428,7 @@ | ||
2421 | 2428 | count=write(file,buffer+i,(MAGICK_POSIX_IO_SIZE_T) (length-i)); |
2422 | 2429 | if (count <= 0) |
2423 | 2430 | break; |
2431 | + total += count; | |
2424 | 2432 | } |
2425 | 2433 | if (i < length) |
2426 | 2434 | break; |
@@ -2428,7 +2436,8 @@ | ||
2428 | 2436 | (void) close(file); |
2429 | 2437 | if (image->logging) |
2430 | 2438 | (void) LogMagickEvent(BlobEvent,GetMagickModule(), |
2431 | - "Copyied %"MAGICK_SIZE_T_F"u bytes from Blob stream to \"%s\"",(MAGICK_SIZE_T) i,filename); | |
2439 | + "Copied %"MAGICK_SIZE_T_F"u bytes from Blob stream to \"%s\"", | |
2440 | + (MAGICK_SIZE_T) total,filename); | |
2432 | 2441 | MagickFreeMemory(buffer); |
2433 | 2442 | return (i < length ? MagickFail : MagickPass); |
2434 | 2443 | } |
@@ -2711,6 +2720,11 @@ | ||
2711 | 2720 | " mode %s ...", image, image->blob, |
2712 | 2721 | BlobModeToString(mode)); |
2713 | 2722 | /* |
2723 | + Set read limits | |
2724 | + */ | |
2725 | + image->blob->read_limit = (size_t) GetMagickResourceLimit(ReadResource); | |
2726 | + image->blob->read_total = 0; | |
2727 | + /* | |
2714 | 2728 | Cache I/O block size |
2715 | 2729 | */ |
2716 | 2730 | image->blob->block_size=MagickGetFileSystemBlockSize(); |
@@ -3152,13 +3166,14 @@ | ||
3152 | 3166 | % |
3153 | 3167 | % |
3154 | 3168 | */ |
3155 | -MagickExport size_t ReadBlob(Image *image,const size_t length,void *data) | |
3169 | +MagickExport size_t ReadBlob(Image *image,const size_t req_length,void *data) | |
3156 | 3170 | { |
3157 | 3171 | BlobInfo |
3158 | 3172 | * restrict blob; |
3159 | 3173 | |
3160 | 3174 | size_t |
3161 | - count; | |
3175 | + count, | |
3176 | + length; | |
3162 | 3177 | |
3163 | 3178 | assert(image != (Image *) NULL); |
3164 | 3179 | assert(image->signature == MagickSignature); |
@@ -3167,6 +3182,9 @@ | ||
3167 | 3182 | assert(data != (void *) NULL); |
3168 | 3183 | |
3169 | 3184 | blob=image->blob; |
3185 | + | |
3186 | + length=Min(req_length,blob->read_limit-blob->read_total); | |
3187 | + | |
3170 | 3188 | count=0; |
3171 | 3189 | switch (blob->type) |
3172 | 3190 | { |
@@ -3336,6 +3354,9 @@ | ||
3336 | 3354 | } |
3337 | 3355 | } |
3338 | 3356 | assert(count <= length); |
3357 | + blob->read_total += count; | |
3358 | + if (count == 0) | |
3359 | + blob->eof=True; | |
3339 | 3360 | return(count); |
3340 | 3361 | } |
3341 | 3362 |
@@ -3434,6 +3455,12 @@ | ||
3434 | 3455 | |
3435 | 3456 | blob=image->blob; |
3436 | 3457 | |
3458 | + if (blob->read_total >= blob->read_limit) | |
3459 | + { | |
3460 | + blob->eof=1; | |
3461 | + return EOF; | |
3462 | + } | |
3463 | + | |
3437 | 3464 | switch (blob->type) |
3438 | 3465 | { |
3439 | 3466 | case FileStream: |
@@ -3449,6 +3476,10 @@ | ||
3449 | 3476 | blob->first_errno=errno; |
3450 | 3477 | } |
3451 | 3478 | } |
3479 | + else | |
3480 | + { | |
3481 | + blob->read_total++; | |
3482 | + } | |
3452 | 3483 | break; |
3453 | 3484 | } |
3454 | 3485 | case BlobStream: |
@@ -3457,6 +3488,7 @@ | ||
3457 | 3488 | { |
3458 | 3489 | octet=*((unsigned char *)blob->data+blob->offset); |
3459 | 3490 | blob->offset++; |
3491 | + blob->read_total++; | |
3460 | 3492 | c=octet; |
3461 | 3493 | } |
3462 | 3494 | else |
@@ -3472,6 +3504,7 @@ | ||
3472 | 3504 | c=octet; |
3473 | 3505 | } |
3474 | 3506 | } |
3507 | + | |
3475 | 3508 | return c; |
3476 | 3509 | } |
3477 | 3510 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | -% Copyright (C) 2008-2019 GraphicsMagick Group | |
2 | +% Copyright (C) 2008-2022 GraphicsMagick Group | |
3 | 3 | % |
4 | 4 | % This program is covered by multiple licenses, which are described in |
5 | 5 | % Copyright.txt. You should have received a copy of Copyright.txt with this |
@@ -1660,6 +1660,8 @@ | ||
1660 | 1660 | resource_type=WidthResource; |
1661 | 1661 | else if (LocaleCompare("Height",option) == 0) |
1662 | 1662 | resource_type=HeightResource; |
1663 | + else if (LocaleCompare("Read",option) == 0) | |
1664 | + resource_type=ReadResource; | |
1663 | 1665 | return resource_type; |
1664 | 1666 | } |
1665 | 1667 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | -% Copyright (C) 2003 - 2019 GraphicsMagick Group | |
2 | +% Copyright (C) 2003 - 2022 GraphicsMagick Group | |
3 | 3 | % Copyright (C) 2002 ImageMagick Studio |
4 | 4 | % |
5 | 5 | % This program is covered by multiple licenses, which are described in |
@@ -96,15 +96,16 @@ | ||
96 | 96 | static ResourceInfo |
97 | 97 | resource_info[] = |
98 | 98 | { |
99 | - { "", "", "", 0, 0, ResourceInfinity, AbsoluteLimit, 0 }, | |
100 | - { "disk", "B", "MAGICK_LIMIT_DISK", 0, 0, ResourceInfinity, SummationLimit, 0 }, | |
101 | - { "files", "", "MAGICK_LIMIT_FILES", 0, 32, 256, SummationLimit, 0 }, | |
102 | - { "map", "B", "MAGICK_LIMIT_MAP", 0, 0, ResourceInfinity, SummationLimit, 0 }, | |
103 | - { "memory", "B", "MAGICK_LIMIT_MEMORY", 0, 0, ResourceInfinity, SummationLimit, 0 }, | |
104 | - { "pixels", "P", "MAGICK_LIMIT_PIXELS", 0, 1, ResourceInfinity, AbsoluteLimit, 0 }, | |
105 | - { "threads", "", "OMP_NUM_THREADS", 1, 1, ResourceInfinity, AbsoluteLimit, 0 }, | |
106 | - { "width", "P", "MAGICK_LIMIT_WIDTH", 0, 1, PIXEL_LIMIT, AbsoluteLimit, 0 }, | |
107 | - { "height", "P", "MAGICK_LIMIT_HEIGHT", 0, 1, PIXEL_LIMIT, AbsoluteLimit, 0 } | |
99 | + { "", "", "", 0, 0, ResourceInfinity, AbsoluteLimit, 0 }, | |
100 | + { "disk", "B", "MAGICK_LIMIT_DISK", 0, 0, ResourceInfinity, SummationLimit, 0 }, | |
101 | + { "files", "", "MAGICK_LIMIT_FILES", 0, 32, 256, SummationLimit, 0 }, | |
102 | + { "map", "B", "MAGICK_LIMIT_MAP", 0, 0, ResourceInfinity, SummationLimit, 0 }, | |
103 | + { "memory", "B", "MAGICK_LIMIT_MEMORY", 0, 0, ResourceInfinity, SummationLimit, 0 }, | |
104 | + { "pixels", "P", "MAGICK_LIMIT_PIXELS", 0, 1, ResourceInfinity, AbsoluteLimit, 0 }, | |
105 | + { "threads", "", "OMP_NUM_THREADS", 1, 1, ResourceInfinity, AbsoluteLimit, 0 }, | |
106 | + { "width", "P", "MAGICK_LIMIT_WIDTH", 0, 1, PIXEL_LIMIT, AbsoluteLimit, 0 }, | |
107 | + { "height", "P", "MAGICK_LIMIT_HEIGHT", 0, 1, PIXEL_LIMIT, AbsoluteLimit, 0 }, | |
108 | + { "read", "B", "MAGICK_LIMIT_READ", 0, 4096, ResourceInfinity, AbsoluteLimit, 0 } | |
108 | 109 | }; |
109 | 110 | |
110 | 111 | /* |
@@ -411,7 +412,8 @@ | ||
411 | 412 | max_pixels=-1, |
412 | 413 | max_threads=1, |
413 | 414 | max_width=-1, |
414 | - max_height=-1; | |
415 | + max_height=-1, | |
416 | + max_read=-1; | |
415 | 417 | |
416 | 418 | size_t |
417 | 419 | index; |
@@ -610,6 +612,9 @@ | ||
610 | 612 | if ((envp=getenv("MAGICK_LIMIT_HEIGHT"))) |
611 | 613 | max_height=MagickSizeStrToInt64(envp,1024); |
612 | 614 | |
615 | + if ((envp=getenv("MAGICK_LIMIT_READ"))) | |
616 | + max_read=MagickSizeStrToInt64(envp,1024); | |
617 | + | |
613 | 618 | #if defined(HAVE_OPENMP) |
614 | 619 | max_threads=omp_get_num_procs(); |
615 | 620 | (void) LogMagickEvent(ResourceEvent,GetMagickModule(), |
@@ -713,6 +718,8 @@ | ||
713 | 718 | (void) SetMagickResourceLimit(WidthResource,max_width); |
714 | 719 | if (max_height >= 0) |
715 | 720 | (void) SetMagickResourceLimit(HeightResource,max_height); |
721 | + if (max_read >= 0) | |
722 | + (void) SetMagickResourceLimit(ReadResource,max_read); | |
716 | 723 | } |
717 | 724 | |
718 | 725 | /* |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - Copyright (C) 2003 - 2015 GraphicsMagick Group | |
2 | + Copyright (C) 2003 - 2022 GraphicsMagick Group | |
3 | 3 | Copyright (C) 2002 ImageMagick Studio |
4 | 4 | |
5 | 5 | This program is covered by multiple licenses, which are described in |
@@ -28,7 +28,8 @@ | ||
28 | 28 | PixelsResource, /* Maximum number of pixels in single image (Pixels) */ |
29 | 29 | ThreadsResource, /* Maximum number of worker threads */ |
30 | 30 | WidthResource, /* Maximum pixel width of an image (Pixels) */ |
31 | - HeightResource /* Maximum pixel height of an image (Pixels) */ | |
31 | + HeightResource, /* Maximum pixel height of an image (Pixels) */ | |
32 | + ReadResource /* Maximum amount of uncompressed file data to read */ | |
32 | 33 | } ResourceType; |
33 | 34 | |
34 | 35 | /* |
@@ -38,8 +38,8 @@ | ||
38 | 38 | #define MagickLibVersion 0x262300 |
39 | 39 | #define MagickLibVersionText "1.4" |
40 | 40 | #define MagickLibVersionNumber 26,23,0 |
41 | -#define MagickChangeDate "20220101" | |
42 | -#define MagickReleaseDate "snapshot-20220101" | |
41 | +#define MagickChangeDate "20220108" | |
42 | +#define MagickReleaseDate "snapshot-20220108" | |
43 | 43 | |
44 | 44 | /* |
45 | 45 | The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines |
@@ -1,4 +1,4 @@ | ||
1 | -.TH gm 1 "2021/12/31" "GraphicsMagick" | |
1 | +.TH gm 1 "2022/01/08" "GraphicsMagick" | |
2 | 2 | .TP |
3 | 3 | .in 15 |
4 | 4 | .in 15 |
@@ -2987,28 +2987,41 @@ | ||
2987 | 2987 | "Input Levels" interface. |
2988 | 2988 | .TP |
2989 | 2989 | .B "-limit \fI<type> <value>"\fP |
2990 | -\fRDisk, File, Map, Memory, Pixels, Width, Height or Threads resource limit | |
2990 | +\fRDisk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit | |
2991 | 2991 | |
2992 | 2992 | By default, resource limits are estimated based on the available |
2993 | -resources of the system. The resource limits are \fBDisk\fP, maximum | |
2994 | -total disk space consumed; \fBFile\fP, maximum number of file | |
2995 | -descriptors allowed to be open at once; \fBMap\fP, maximum total | |
2996 | -number of file bytes which may be memory mapped; \fBMemory\fP, | |
2997 | -maximum total number of bytes of heap memory used for image storage; | |
2998 | -\fBPixels\fP, maximum absolute image size (per image); \fBWidth\fP, | |
2999 | -maximum image pixels width; \fBHeight\fP, maximum image pixels | |
3000 | -height; and \fBThreads\fP, the maximum number of worker threads to | |
3001 | -use per OpenMP thread team. | |
3002 | - | |
3003 | -These resource limits are used to decide if (for a given image) the | |
3004 | -decoded image ("pixel cache") should be stored in heap memory (RAM), | |
3005 | -in a memory-mapped disk file, or in a disk file accessed via | |
3006 | -read/write I/O. The number of total pixels in one image, and/or the | |
3007 | -width/height, may also be limited in order to force the reading, or | |
3008 | -creation of images larger than the limit (in pixels) to intentionally | |
3009 | -fail. The disk limit establishes an overall limit since using the disk | |
3010 | -is the means of last resort. When the disk limit has been reached, no | |
3011 | -more images may be read. | |
2993 | +resources and capabilities of the system. The resource limits are | |
2994 | +\fBDisk\fP, maximum total disk space consumed; \fBFile\fP, maximum | |
2995 | +number of file descriptors allowed to be open at once; \fBMap\fP, | |
2996 | +maximum total number of file bytes which may be memory mapped; | |
2997 | +\fBMemory\fP, maximum total number of bytes of heap memory used for | |
2998 | +image storage; \fBPixels\fP, maximum absolute image size (per image); | |
2999 | +\fBWidth\fP, maximum image pixels width; \fBHeight\fP, maximum image | |
3000 | +pixels height; \fBRead\fP, maximum number of uncompressed bytes to | |
3001 | +read; and \fBThreads\fP, the maximum number of worker threads to use | |
3002 | +per OpenMP thread team. | |
3003 | + | |
3004 | +The \fBDisk\fP and \fBMap\fP resource limits are used to decide if | |
3005 | +(for a given image) the decoded image ("pixel cache") should be stored | |
3006 | +in heap memory (RAM), in a memory-mapped disk file, or in a disk file | |
3007 | +accessed via read/write I/O. | |
3008 | + | |
3009 | +The number of total pixels in one image (\fBPixels\fP), and/or the | |
3010 | +width/height (\fBWidth\fP/\fBHeight\fP), may be limited in order to | |
3011 | +force the reading, or creation of images larger than the limit (in | |
3012 | +pixels) to intentionally fail. The disk limit (\fBDisk\fP) | |
3013 | +establishes an overall limit since using the disk is the means of last | |
3014 | +resort. When the disk limit has been reached, no more images may be | |
3015 | +read. | |
3016 | + | |
3017 | +The amount of uncompressed data read when reading one image may be | |
3018 | +limited by the \fBRead\fP limit. Reading the image fails when the | |
3019 | +limit is hit. This option is useful if the data is read from a stream | |
3020 | +(pipe) or from a compressed file such as a gzipped file. Some files | |
3021 | +are very compressable and so a small compressed file can decompress to | |
3022 | +a huge amount of data. This option also defends against files which | |
3023 | +produce seemingly endless loops while decoding by seeking backwards in | |
3024 | +the file. | |
3012 | 3025 | |
3013 | 3026 | The value argument is an absolute value, but may have standard binary |
3014 | 3027 | suffix characters applied ('K', 'M', 'G', 'T', 'P', 'E') to apply a |
@@ -3022,10 +3035,11 @@ | ||
3022 | 3035 | environment variables \fBMAGICK_LIMIT_DISK\fP, |
3023 | 3036 | \fBMAGICK_LIMIT_FILES\fP, \fBMAGICK_LIMIT_MAP\fP, |
3024 | 3037 | \fBMAGICK_LIMIT_MEMORY\fP, \fBMAGICK_LIMIT_PIXELS\fP, |
3025 | -\fBMAGICK_LIMIT_WIDTH\fP, \fBMAGICK_LIMIT_HEIGHT\fP,and | |
3026 | -\fBOMP_NUM_THREADS\fP may be used to set the limits for disk space, | |
3027 | -open files, memory mapped size, heap memory, per-image pixels, image | |
3028 | -width, image height, and threads respectively. | |
3038 | +\fBMAGICK_LIMIT_WIDTH\fP, \fBMAGICK_LIMIT_HEIGHT\fP. | |
3039 | +\fBMAGICK_LIMIT_READ\fP, and \fBOMP_NUM_THREADS\fP may be used to | |
3040 | +set the limits for disk space, open files, memory mapped size, heap | |
3041 | +memory, per-image pixels, image width, image height, and threads | |
3042 | +respectively. | |
3029 | 3043 | |
3030 | 3044 | Use the option -list resource list the current limits. |
3031 | 3045 | .TP |
@@ -5079,6 +5093,15 @@ | ||
5079 | 5093 | number of pixels due to multiple image frames/pages (e.g. multi-page |
5080 | 5094 | document or an animation). |
5081 | 5095 | .TP |
5096 | +.B "MAGICK_LIMIT_READ" | |
5097 | +\fRMaximum number of uncompressed bytes which may be read while | |
5098 | +decoding an image. Each read by the software from the input file is | |
5099 | +counted against the total, even if it has been read before. Decoding | |
5100 | +fails when the limit is reached. This limit helps defend against | |
5101 | +highly compressed files (e.g. via gzip), or files which use complex | |
5102 | +looping structures, or when data is being read from a stream | |
5103 | +(pipe). | |
5104 | +.TP | |
5082 | 5105 | .B "MAGICK_LIMIT_WIDTH" |
5083 | 5106 | \fRMaximum pixel width of an image read, or created. |
5084 | 5107 | .TP |
@@ -5302,7 +5325,7 @@ | ||
5302 | 5325 | \fRthe type of interlacing scheme |
5303 | 5326 | .TP |
5304 | 5327 | .B "-limit \fI<type> <value>"\fP |
5305 | -\fRDisk, File, Map, Memory, Pixels, Width, Height or Threads resource limit | |
5328 | +\fRDisk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit | |
5306 | 5329 | .TP |
5307 | 5330 | .B "-log \fI<string>"\fP |
5308 | 5331 | \fRSpecify format for debug log |
@@ -5905,7 +5928,7 @@ | ||
5905 | 5928 | \fRthe type of interlacing scheme |
5906 | 5929 | .TP |
5907 | 5930 | .B "-limit \fI<type> <value>"\fP |
5908 | -\fRDisk, File, Map, Memory, Pixels, Width, Height or Threads resource limit | |
5931 | +\fRDisk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit | |
5909 | 5932 | .TP |
5910 | 5933 | .B "-log \fI<string>"\fP |
5911 | 5934 | \fRSpecify format for debug log |
@@ -6086,7 +6109,7 @@ | ||
6086 | 6109 | \fRassign a label to an image |
6087 | 6110 | .TP |
6088 | 6111 | .B "-limit \fI<type> <value>"\fP |
6089 | -\fRDisk, File, Map, Memory, Pixels, Width, Height or Threads resource limit | |
6112 | +\fRDisk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit | |
6090 | 6113 | .TP |
6091 | 6114 | .B "-log \fI<string>"\fP |
6092 | 6115 | \fRSpecify format for debug log |
@@ -7105,7 +7128,7 @@ | ||
7105 | 7128 | \fRadjust the level of image contrast |
7106 | 7129 | .TP |
7107 | 7130 | .B "-limit \fI<type> <value>"\fP |
7108 | -\fRDisk, File, Map, Memory, Pixels, Width, Height or Threads resource limit | |
7131 | +\fRDisk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit | |
7109 | 7132 | .TP |
7110 | 7133 | .B "-list \fI<type>"\fP |
7111 | 7134 | \fRthe type of list |
@@ -7620,7 +7643,7 @@ | ||
7620 | 7643 | \fRassign a label to an image |
7621 | 7644 | .TP |
7622 | 7645 | .B "-limit \fI<type> <value>"\fP |
7623 | -\fRDisk, File, Map, Memory, Pixels, Width, Height or Threads resource limit | |
7646 | +\fRDisk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit | |
7624 | 7647 | .TP |
7625 | 7648 | .B "-log \fI<string>"\fP |
7626 | 7649 | \fRSpecify format for debug log |
@@ -9630,7 +9653,7 @@ | ||
9630 | 9653 | \fRthe type of interlacing scheme |
9631 | 9654 | .TP |
9632 | 9655 | .B "-limit \fI<type> <value>"\fP |
9633 | -\fRDisk, File, Map, Memory, Pixels, Width, Height or Threads resource limit | |
9656 | +\fRDisk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit | |
9634 | 9657 | .TP |
9635 | 9658 | .B "-log \fI<string>"\fP |
9636 | 9659 | \fRSpecify format for debug log |
@@ -9777,7 +9800,7 @@ | ||
9777 | 9800 | \fRassign a label to an image |
9778 | 9801 | .TP |
9779 | 9802 | .B "-limit \fI<type> <value>"\fP |
9780 | -\fRDisk, File, Map, Memory, Pixels, Width, Height or Threads resource limit | |
9803 | +\fRDisk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit | |
9781 | 9804 | .TP |
9782 | 9805 | .B "-log \fI<string>"\fP |
9783 | 9806 | \fRSpecify format for debug log |
@@ -10085,7 +10108,7 @@ | ||
10085 | 10108 | \fRadjust the level of image contrast |
10086 | 10109 | .TP |
10087 | 10110 | .B "-limit \fI<type> <value>"\fP |
10088 | -\fRDisk, File, Map, Memory, Pixels, Width, Height or Threads resource limit | |
10111 | +\fRDisk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit | |
10089 | 10112 | .TP |
10090 | 10113 | .B "-linewidth" |
10091 | 10114 | \fRthe line width for subsequent draw operations |
@@ -10552,7 +10575,7 @@ | ||
10552 | 10575 | \fRassign a label to an image |
10553 | 10576 | .TP |
10554 | 10577 | .B "-limit \fI<type> <value>"\fP |
10555 | -\fRDisk, File, Map, Memory, Pixels, Width, Height or Threads resource limit | |
10578 | +\fRDisk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit | |
10556 | 10579 | .TP |
10557 | 10580 | .B "-log \fI<string>"\fP |
10558 | 10581 | \fRSpecify format for debug log |
@@ -35,6 +35,15 @@ | ||
35 | 35 | <div class="document"> |
36 | 36 | |
37 | 37 | |
38 | +<p>2022-01-08 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p> | |
39 | +<blockquote> | |
40 | +<p>* magick/resource.c: Add support for setting a read resource limit | |
41 | +via the MAGICK_LIMIT_READ environment variable, or similar to | |
42 | +'-limit read 5mb'.</p> | |
43 | +<p>* magick/resource.h: Added a ReadResource limit, which is a limit | |
44 | +on how many uncompressed file bytes may be read while decoding an | |
45 | +input file.</p> | |
46 | +</blockquote> | |
38 | 47 | <p>2022-01-01 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p> |
39 | 48 | <blockquote> |
40 | 49 | * ChangeLog.2021: Rotate ChangeLog for 2022. Happy New Year!</blockquote> |
@@ -3323,28 +3323,41 @@ | ||
3323 | 3323 | ><font color="#00B04F"><font size="+1"> |
3324 | 3324 | <a name="details-limit"></a>-limit <i><type> <value></i> |
3325 | 3325 | </font></font></font></b></td></tr></table> |
3326 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
3326 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
3327 | 3327 | <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> |
3328 | 3328 | By default, resource limits are estimated based on the available |
3329 | -resources of the system. The resource limits are <strong>Disk</strong>, maximum | |
3330 | -total disk space consumed; <strong>File</strong>, maximum number of file | |
3331 | -descriptors allowed to be open at once; <strong>Map</strong>, maximum total | |
3332 | -number of file bytes which may be memory mapped; <strong>Memory</strong>, | |
3333 | -maximum total number of bytes of heap memory used for image storage; | |
3334 | -<strong>Pixels</strong>, maximum absolute image size (per image); <strong>Width</strong>, | |
3335 | -maximum image pixels width; <strong>Height</strong>, maximum image pixels | |
3336 | -height; and <strong>Threads</strong>, the maximum number of worker threads to | |
3337 | -use per OpenMP thread team.</font></td></tr></table> | |
3338 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> | |
3339 | -These resource limits are used to decide if (for a given image) the | |
3340 | -decoded image ("pixel cache") should be stored in heap memory (RAM), | |
3341 | -in a memory-mapped disk file, or in a disk file accessed via | |
3342 | -read/write I/O. The number of total pixels in one image, and/or the | |
3343 | -width/height, may also be limited in order to force the reading, or | |
3344 | -creation of images larger than the limit (in pixels) to intentionally | |
3345 | -fail. The disk limit establishes an overall limit since using the disk | |
3346 | -is the means of last resort. When the disk limit has been reached, no | |
3347 | -more images may be read.</font></td></tr></table> | |
3329 | +resources and capabilities of the system. The resource limits are | |
3330 | +<strong>Disk</strong>, maximum total disk space consumed; <strong>File</strong>, maximum | |
3331 | +number of file descriptors allowed to be open at once; <strong>Map</strong>, | |
3332 | +maximum total number of file bytes which may be memory mapped; | |
3333 | +<strong>Memory</strong>, maximum total number of bytes of heap memory used for | |
3334 | +image storage; <strong>Pixels</strong>, maximum absolute image size (per image); | |
3335 | +<strong>Width</strong>, maximum image pixels width; <strong>Height</strong>, maximum image | |
3336 | +pixels height; <strong>Read</strong>, maximum number of uncompressed bytes to | |
3337 | +read; and <strong>Threads</strong>, the maximum number of worker threads to use | |
3338 | +per OpenMP thread team.</font></td></tr></table> | |
3339 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> | |
3340 | +The <strong>Disk</strong> and <strong>Map</strong> resource limits are used to decide if | |
3341 | +(for a given image) the decoded image ("pixel cache") should be stored | |
3342 | +in heap memory (RAM), in a memory-mapped disk file, or in a disk file | |
3343 | +accessed via read/write I/O.</font></td></tr></table> | |
3344 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> | |
3345 | +The number of total pixels in one image (<strong>Pixels</strong>), and/or the | |
3346 | +width/height (<strong>Width</strong>/<strong>Height</strong>), may be limited in order to | |
3347 | +force the reading, or creation of images larger than the limit (in | |
3348 | +pixels) to intentionally fail. The disk limit (<strong>Disk</strong>) | |
3349 | +establishes an overall limit since using the disk is the means of last | |
3350 | +resort. When the disk limit has been reached, no more images may be | |
3351 | +read.</font></td></tr></table> | |
3352 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> | |
3353 | +The amount of uncompressed data read when reading one image may be | |
3354 | +limited by the <strong>Read</strong> limit. Reading the image fails when the | |
3355 | +limit is hit. This option is useful if the data is read from a stream | |
3356 | +(pipe) or from a compressed file such as a gzipped file. Some files | |
3357 | +are very compressable and so a small compressed file can decompress to | |
3358 | +a huge amount of data. This option also defends against files which | |
3359 | +produce seemingly endless loops while decoding by seeking backwards in | |
3360 | +the file.</font></td></tr></table> | |
3348 | 3361 | <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> |
3349 | 3362 | The value argument is an absolute value, but may have standard binary |
3350 | 3363 | suffix characters applied ('K', 'M', 'G', 'T', 'P', 'E') to apply a |
@@ -3358,10 +3371,11 @@ | ||
3358 | 3371 | environment variables <strong>MAGICK_LIMIT_DISK</strong>, |
3359 | 3372 | <strong>MAGICK_LIMIT_FILES</strong>, <strong>MAGICK_LIMIT_MAP</strong>, |
3360 | 3373 | <strong>MAGICK_LIMIT_MEMORY</strong>, <strong>MAGICK_LIMIT_PIXELS</strong>, |
3361 | -<strong>MAGICK_LIMIT_WIDTH</strong>, <strong>MAGICK_LIMIT_HEIGHT</strong>,and | |
3362 | -<strong>OMP_NUM_THREADS</strong> may be used to set the limits for disk space, | |
3363 | -open files, memory mapped size, heap memory, per-image pixels, image | |
3364 | -width, image height, and threads respectively.</font></td></tr></table> | |
3374 | +<strong>MAGICK_LIMIT_WIDTH</strong>, <strong>MAGICK_LIMIT_HEIGHT</strong>. | |
3375 | +<strong>MAGICK_LIMIT_READ</strong>, and <strong>OMP_NUM_THREADS</strong> may be used to | |
3376 | +set the limits for disk space, open files, memory mapped size, heap | |
3377 | +memory, per-image pixels, image width, image height, and threads | |
3378 | +respectively.</font></td></tr></table> | |
3365 | 3379 | <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> |
3366 | 3380 | Use the option <tt>-list resource</tt> list the current limits.</font></td></tr></table> |
3367 | 3381 | <table BORDER=0 WIDTH="94%"> |
@@ -6265,6 +6279,23 @@ | ||
6265 | 6279 | ALT=">" BORDER=0 height=14 |
6266 | 6280 | width=15><b><font face="Helvetica, Arial" |
6267 | 6281 | ><font color="#00B04F"><font size="+1"> |
6282 | + MAGICK_LIMIT_READ | |
6283 | +</font></font></font></b></td></tr></table> | |
6284 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Maximum number of uncompressed bytes which may be read while | |
6285 | +decoding an image. Each read by the software from the input file is | |
6286 | +counted against the total, even if it has been read before. Decoding | |
6287 | +fails when the limit is reached. This limit helps defend against | |
6288 | +highly compressed files (e.g. via gzip), or files which use complex | |
6289 | +looping structures, or when data is being read from a stream | |
6290 | +(pipe).</td></tr></table> | |
6291 | +<table BORDER=0 WIDTH="94%"> | |
6292 | +<tr> | |
6293 | +<td width="3%"><br></td> | |
6294 | +<td ALIGN=LEFT BGCOLOR="#FFFFFF"> | |
6295 | +<img SRC="images/right_triangle_option.png" | |
6296 | +ALT=">" BORDER=0 height=14 | |
6297 | +width=15><b><font face="Helvetica, Arial" | |
6298 | +><font color="#00B04F"><font size="+1"> | |
6268 | 6299 | MAGICK_LIMIT_WIDTH |
6269 | 6300 | </font></font></font></b></td></tr></table> |
6270 | 6301 | <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Maximum pixel width of an image read, or created.</td></tr></table> |
@@ -463,7 +463,7 @@ | ||
463 | 463 | ><font color="#00B04F"><font size="+1"> |
464 | 464 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
465 | 465 | </font></font></font></b></td></tr></table> |
466 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
466 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
467 | 467 | <table BORDER=0 WIDTH="94%"> |
468 | 468 | <tr> |
469 | 469 | <td width="3%"><br></td> |
@@ -297,7 +297,7 @@ | ||
297 | 297 | ><font color="#00B04F"><font size="+1"> |
298 | 298 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
299 | 299 | </font></font></font></b></td></tr></table> |
300 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
300 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
301 | 301 | <table BORDER=0 WIDTH="94%"> |
302 | 302 | <tr> |
303 | 303 | <td width="3%"><br></td> |
@@ -476,7 +476,7 @@ | ||
476 | 476 | ><font color="#00B04F"><font size="+1"> |
477 | 477 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
478 | 478 | </font></font></font></b></td></tr></table> |
479 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
479 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
480 | 480 | <table BORDER=0 WIDTH="94%"> |
481 | 481 | <tr> |
482 | 482 | <td width="3%"><br></td> |
@@ -995,7 +995,7 @@ | ||
995 | 995 | ><font color="#00B04F"><font size="+1"> |
996 | 996 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
997 | 997 | </font></font></font></b></td></tr></table> |
998 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
998 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
999 | 999 | <table BORDER=0 WIDTH="94%"> |
1000 | 1000 | <tr> |
1001 | 1001 | <td width="3%"><br></td> |
@@ -731,7 +731,7 @@ | ||
731 | 731 | ><font color="#00B04F"><font size="+1"> |
732 | 732 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
733 | 733 | </font></font></font></b></td></tr></table> |
734 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
734 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
735 | 735 | <table BORDER=0 WIDTH="94%"> |
736 | 736 | <tr> |
737 | 737 | <td width="3%"><br></td> |
@@ -3286,28 +3286,41 @@ | ||
3286 | 3286 | ><font color="#00B04F"><font size="+1"> |
3287 | 3287 | <a name="details-limit"></a>-limit <i><type> <value></i> |
3288 | 3288 | </font></font></font></b></td></tr></table> |
3289 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
3289 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
3290 | 3290 | <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> |
3291 | 3291 | By default, resource limits are estimated based on the available |
3292 | -resources of the system. The resource limits are <strong>Disk</strong>, maximum | |
3293 | -total disk space consumed; <strong>File</strong>, maximum number of file | |
3294 | -descriptors allowed to be open at once; <strong>Map</strong>, maximum total | |
3295 | -number of file bytes which may be memory mapped; <strong>Memory</strong>, | |
3296 | -maximum total number of bytes of heap memory used for image storage; | |
3297 | -<strong>Pixels</strong>, maximum absolute image size (per image); <strong>Width</strong>, | |
3298 | -maximum image pixels width; <strong>Height</strong>, maximum image pixels | |
3299 | -height; and <strong>Threads</strong>, the maximum number of worker threads to | |
3300 | -use per OpenMP thread team.</font></td></tr></table> | |
3301 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> | |
3302 | -These resource limits are used to decide if (for a given image) the | |
3303 | -decoded image ("pixel cache") should be stored in heap memory (RAM), | |
3304 | -in a memory-mapped disk file, or in a disk file accessed via | |
3305 | -read/write I/O. The number of total pixels in one image, and/or the | |
3306 | -width/height, may also be limited in order to force the reading, or | |
3307 | -creation of images larger than the limit (in pixels) to intentionally | |
3308 | -fail. The disk limit establishes an overall limit since using the disk | |
3309 | -is the means of last resort. When the disk limit has been reached, no | |
3310 | -more images may be read.</font></td></tr></table> | |
3292 | +resources and capabilities of the system. The resource limits are | |
3293 | +<strong>Disk</strong>, maximum total disk space consumed; <strong>File</strong>, maximum | |
3294 | +number of file descriptors allowed to be open at once; <strong>Map</strong>, | |
3295 | +maximum total number of file bytes which may be memory mapped; | |
3296 | +<strong>Memory</strong>, maximum total number of bytes of heap memory used for | |
3297 | +image storage; <strong>Pixels</strong>, maximum absolute image size (per image); | |
3298 | +<strong>Width</strong>, maximum image pixels width; <strong>Height</strong>, maximum image | |
3299 | +pixels height; <strong>Read</strong>, maximum number of uncompressed bytes to | |
3300 | +read; and <strong>Threads</strong>, the maximum number of worker threads to use | |
3301 | +per OpenMP thread team.</font></td></tr></table> | |
3302 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> | |
3303 | +The <strong>Disk</strong> and <strong>Map</strong> resource limits are used to decide if | |
3304 | +(for a given image) the decoded image ("pixel cache") should be stored | |
3305 | +in heap memory (RAM), in a memory-mapped disk file, or in a disk file | |
3306 | +accessed via read/write I/O.</font></td></tr></table> | |
3307 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> | |
3308 | +The number of total pixels in one image (<strong>Pixels</strong>), and/or the | |
3309 | +width/height (<strong>Width</strong>/<strong>Height</strong>), may be limited in order to | |
3310 | +force the reading, or creation of images larger than the limit (in | |
3311 | +pixels) to intentionally fail. The disk limit (<strong>Disk</strong>) | |
3312 | +establishes an overall limit since using the disk is the means of last | |
3313 | +resort. When the disk limit has been reached, no more images may be | |
3314 | +read.</font></td></tr></table> | |
3315 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> | |
3316 | +The amount of uncompressed data read when reading one image may be | |
3317 | +limited by the <strong>Read</strong> limit. Reading the image fails when the | |
3318 | +limit is hit. This option is useful if the data is read from a stream | |
3319 | +(pipe) or from a compressed file such as a gzipped file. Some files | |
3320 | +are very compressable and so a small compressed file can decompress to | |
3321 | +a huge amount of data. This option also defends against files which | |
3322 | +produce seemingly endless loops while decoding by seeking backwards in | |
3323 | +the file.</font></td></tr></table> | |
3311 | 3324 | <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> |
3312 | 3325 | The value argument is an absolute value, but may have standard binary |
3313 | 3326 | suffix characters applied ('K', 'M', 'G', 'T', 'P', 'E') to apply a |
@@ -3321,10 +3334,11 @@ | ||
3321 | 3334 | environment variables <strong>MAGICK_LIMIT_DISK</strong>, |
3322 | 3335 | <strong>MAGICK_LIMIT_FILES</strong>, <strong>MAGICK_LIMIT_MAP</strong>, |
3323 | 3336 | <strong>MAGICK_LIMIT_MEMORY</strong>, <strong>MAGICK_LIMIT_PIXELS</strong>, |
3324 | -<strong>MAGICK_LIMIT_WIDTH</strong>, <strong>MAGICK_LIMIT_HEIGHT</strong>,and | |
3325 | -<strong>OMP_NUM_THREADS</strong> may be used to set the limits for disk space, | |
3326 | -open files, memory mapped size, heap memory, per-image pixels, image | |
3327 | -width, image height, and threads respectively.</font></td></tr></table> | |
3337 | +<strong>MAGICK_LIMIT_WIDTH</strong>, <strong>MAGICK_LIMIT_HEIGHT</strong>. | |
3338 | +<strong>MAGICK_LIMIT_READ</strong>, and <strong>OMP_NUM_THREADS</strong> may be used to | |
3339 | +set the limits for disk space, open files, memory mapped size, heap | |
3340 | +memory, per-image pixels, image width, image height, and threads | |
3341 | +respectively.</font></td></tr></table> | |
3328 | 3342 | <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1"> |
3329 | 3343 | Use the option <tt>-list resource</tt> list the current limits.</font></td></tr></table> |
3330 | 3344 | <table BORDER=0 WIDTH="94%"> |
@@ -6228,6 +6242,23 @@ | ||
6228 | 6242 | ALT=">" BORDER=0 height=14 |
6229 | 6243 | width=15><b><font face="Helvetica, Arial" |
6230 | 6244 | ><font color="#00B04F"><font size="+1"> |
6245 | + MAGICK_LIMIT_READ | |
6246 | +</font></font></font></b></td></tr></table> | |
6247 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Maximum number of uncompressed bytes which may be read while | |
6248 | +decoding an image. Each read by the software from the input file is | |
6249 | +counted against the total, even if it has been read before. Decoding | |
6250 | +fails when the limit is reached. This limit helps defend against | |
6251 | +highly compressed files (e.g. via gzip), or files which use complex | |
6252 | +looping structures, or when data is being read from a stream | |
6253 | +(pipe).</td></tr></table> | |
6254 | +<table BORDER=0 WIDTH="94%"> | |
6255 | +<tr> | |
6256 | +<td width="3%"><br></td> | |
6257 | +<td ALIGN=LEFT BGCOLOR="#FFFFFF"> | |
6258 | +<img SRC="images/right_triangle_option.png" | |
6259 | +ALT=">" BORDER=0 height=14 | |
6260 | +width=15><b><font face="Helvetica, Arial" | |
6261 | +><font color="#00B04F"><font size="+1"> | |
6231 | 6262 | MAGICK_LIMIT_WIDTH |
6232 | 6263 | </font></font></font></b></td></tr></table> |
6233 | 6264 | <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Maximum pixel width of an image read, or created.</td></tr></table> |
@@ -6794,7 +6825,7 @@ | ||
6794 | 6825 | ><font color="#00B04F"><font size="+1"> |
6795 | 6826 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
6796 | 6827 | </font></font></font></b></td></tr></table> |
6797 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
6828 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
6798 | 6829 | <table BORDER=0 WIDTH="94%"> |
6799 | 6830 | <tr> |
6800 | 6831 | <td width="3%"><br></td> |
@@ -7869,7 +7900,7 @@ | ||
7869 | 7900 | ><font color="#00B04F"><font size="+1"> |
7870 | 7901 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
7871 | 7902 | </font></font></font></b></td></tr></table> |
7872 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
7903 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
7873 | 7904 | <table BORDER=0 WIDTH="94%"> |
7874 | 7905 | <tr> |
7875 | 7906 | <td width="3%"><br></td> |
@@ -8383,7 +8414,7 @@ | ||
8383 | 8414 | ><font color="#00B04F"><font size="+1"> |
8384 | 8415 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
8385 | 8416 | </font></font></font></b></td></tr></table> |
8386 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
8417 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
8387 | 8418 | <table BORDER=0 WIDTH="94%"> |
8388 | 8419 | <tr> |
8389 | 8420 | <td width="3%"><br></td> |
@@ -10066,7 +10097,7 @@ | ||
10066 | 10097 | ><font color="#00B04F"><font size="+1"> |
10067 | 10098 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
10068 | 10099 | </font></font></font></b></td></tr></table> |
10069 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
10100 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
10070 | 10101 | <table BORDER=0 WIDTH="94%"> |
10071 | 10102 | <tr> |
10072 | 10103 | <td width="3%"><br></td> |
@@ -11584,7 +11615,7 @@ | ||
11584 | 11615 | ><font color="#00B04F"><font size="+1"> |
11585 | 11616 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
11586 | 11617 | </font></font></font></b></td></tr></table> |
11587 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
11618 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
11588 | 11619 | <table BORDER=0 WIDTH="94%"> |
11589 | 11620 | <tr> |
11590 | 11621 | <td width="3%"><br></td> |
@@ -14646,7 +14677,7 @@ | ||
14646 | 14677 | ><font color="#00B04F"><font size="+1"> |
14647 | 14678 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
14648 | 14679 | </font></font></font></b></td></tr></table> |
14649 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
14680 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
14650 | 14681 | <table BORDER=0 WIDTH="94%"> |
14651 | 14682 | <tr> |
14652 | 14683 | <td width="3%"><br></td> |
@@ -15053,7 +15084,7 @@ | ||
15053 | 15084 | ><font color="#00B04F"><font size="+1"> |
15054 | 15085 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
15055 | 15086 | </font></font></font></b></td></tr></table> |
15056 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
15087 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
15057 | 15088 | <table BORDER=0 WIDTH="94%"> |
15058 | 15089 | <tr> |
15059 | 15090 | <td width="3%"><br></td> |
@@ -16075,7 +16106,7 @@ | ||
16075 | 16106 | ><font color="#00B04F"><font size="+1"> |
16076 | 16107 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
16077 | 16108 | </font></font></font></b></td></tr></table> |
16078 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
16109 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
16079 | 16110 | <table BORDER=0 WIDTH="94%"> |
16080 | 16111 | <tr> |
16081 | 16112 | <td width="3%"><br></td> |
@@ -17496,7 +17527,7 @@ | ||
17496 | 17527 | ><font color="#00B04F"><font size="+1"> |
17497 | 17528 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
17498 | 17529 | </font></font></font></b></td></tr></table> |
17499 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
17530 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
17500 | 17531 | <table BORDER=0 WIDTH="94%"> |
17501 | 17532 | <tr> |
17502 | 17533 | <td width="3%"><br></td> |
@@ -246,7 +246,7 @@ | ||
246 | 246 | ><font color="#00B04F"><font size="+1"> |
247 | 247 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
248 | 248 | </font></font></font></b></td></tr></table> |
249 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
249 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
250 | 250 | <table BORDER=0 WIDTH="94%"> |
251 | 251 | <tr> |
252 | 252 | <td width="3%"><br></td> |
@@ -409,7 +409,7 @@ | ||
409 | 409 | ><font color="#00B04F"><font size="+1"> |
410 | 410 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
411 | 411 | </font></font></font></b></td></tr></table> |
412 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
412 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
413 | 413 | <table BORDER=0 WIDTH="94%"> |
414 | 414 | <tr> |
415 | 415 | <td width="3%"><br></td> |
@@ -843,7 +843,7 @@ | ||
843 | 843 | ><font color="#00B04F"><font size="+1"> |
844 | 844 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
845 | 845 | </font></font></font></b></td></tr></table> |
846 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
846 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
847 | 847 | <table BORDER=0 WIDTH="94%"> |
848 | 848 | <tr> |
849 | 849 | <td width="3%"><br></td> |
@@ -637,7 +637,7 @@ | ||
637 | 637 | ><font color="#00B04F"><font size="+1"> |
638 | 638 | <a href="GraphicsMagick.html#details-limit">-limit</a> <i><type> <value></i> |
639 | 639 | </font></font></font></b></td></tr></table> |
640 | -<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height or Threads resource limit</td></tr></table> | |
640 | +<table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td>Disk, File, Map, Memory, Pixels, Width, Height, Read, or Threads resource limit</td></tr></table> | |
641 | 641 | <table BORDER=0 WIDTH="94%"> |
642 | 642 | <tr> |
643 | 643 | <td width="3%"><br></td> |