• R/O
  • SSH

GM: Commit

Main GraphicsMagick source repository


Commit MetaInfo

Revision121de89bed951639c7d1c2b6bb2350bc1c6e7e9a (tree)
Time2022-01-09 08:14:10
AuthorBob Friesenhahn <bfriesen@Grap...>
CommiterBob Friesenhahn

Log Message

Added support for a Read resource limit.

Change Summary

Incremental Difference

diff -r eae611832371 -r 121de89bed95 ChangeLog
--- a/ChangeLog Sat Jan 01 12:38:34 2022 -0600
+++ b/ChangeLog Sat Jan 08 17:14:10 2022 -0600
@@ -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+
111 2022-01-01 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
212
313 * ChangeLog.2021: Rotate ChangeLog for 2022. Happy New Year!
diff -r eae611832371 -r 121de89bed95 VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx Sat Jan 01 12:38:34 2022 -0600
+++ b/VisualMagick/installer/inc/version.isx Sat Jan 08 17:14:10 2022 -0600
@@ -10,5 +10,5 @@
1010
1111 #define public MagickPackageName "GraphicsMagick"
1212 #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"
diff -r eae611832371 -r 121de89bed95 doc/environment.imdoc
--- a/doc/environment.imdoc Sat Jan 01 12:38:34 2022 -0600
+++ b/doc/environment.imdoc Sat Jan 08 17:14:10 2022 -0600
@@ -195,6 +195,16 @@
195195 number of pixels due to multiple image frames/pages (e.g. multi-page
196196 document or an animation).</abs>
197197
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+
198208 <opt>MAGICK_LIMIT_WIDTH</opt>
199209
200210 <abs>Maximum pixel width of an image read, or created.</abs>
diff -r eae611832371 -r 121de89bed95 doc/options.imdoc
--- a/doc/options.imdoc Sat Jan 01 12:38:34 2022 -0600
+++ b/doc/options.imdoc Sat Jan 08 17:14:10 2022 -0600
@@ -3210,30 +3210,45 @@
32103210 <utils apps=animate,compare,composite,convert,display,identify,import,mogrify,montage>
32113211 <dopt>-limit <type> <value></opt>
32123212
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>
32143214
32153215 <pp>
32163216 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>
32373252
32383253 <pp>
32393254 The value argument is an absolute value, but may have standard binary
@@ -3249,10 +3264,11 @@
32493264 environment variables <s>MAGICK_LIMIT_DISK</s>,
32503265 <s>MAGICK_LIMIT_FILES</s>, <s>MAGICK_LIMIT_MAP</s>,
32513266 <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>
32563272
32573273 <pp>
32583274 Use the option <tt>-list resource</tt> list the current limits.</pp>
diff -r eae611832371 -r 121de89bed95 fuzzing/utils.cc
--- a/fuzzing/utils.cc Sat Jan 01 12:38:34 2022 -0600
+++ b/fuzzing/utils.cc Sat Jan 08 17:14:10 2022 -0600
@@ -22,6 +22,7 @@
2222 MagickLib::SetMagickResourceLimit(MagickLib::WidthResource, 2048);
2323 MagickLib::SetMagickResourceLimit(MagickLib::HeightResource, 2048);
2424 MagickLib::SetMagickResourceLimit(MagickLib::DiskResource, 0);
25+ MagickLib::SetMagickResourceLimit(MagickLib::ReadResource, 900000);
2526 }
2627 };
2728
diff -r eae611832371 -r 121de89bed95 magick/blob.c
--- a/magick/blob.c Sat Jan 01 12:38:34 2022 -0600
+++ b/magick/blob.c Sat Jan 08 17:14:10 2022 -0600
@@ -1,5 +1,5 @@
11 /*
2-% Copyright (C) 2003 - 2021 GraphicsMagick Group
2+% Copyright (C) 2003 - 2022 GraphicsMagick Group
33 % Copyright (C) 2002 ImageMagick Studio
44 % Copyright 1991-1999 E. I. du Pont de Nemours and Company
55 %
@@ -104,6 +104,8 @@
104104 block_size, /* I/O block size */
105105 length, /* The current size of the BLOB data. */
106106 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 */
107109 quantum; /* The amount by which to increase the size of the backing store */
108110
109111 unsigned int
@@ -269,10 +271,11 @@
269271 return 0;
270272 }
271273 *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);
273275 blob->offset+=available;
274- if (available < length)
276+ if (available == 0)
275277 blob->eof=True;
278+ blob->read_total += available;
276279 return available;
277280 }
278281
@@ -1318,38 +1321,41 @@
13181321 assert(image->blob != (BlobInfo *) NULL);
13191322 assert(image->blob->type != UndefinedStream);
13201323 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)
13281325 {
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+ {
13341339 #if defined(HasZLIB) && !defined(DISABLE_COMPRESSED_FILES)
1335- blob->eof=gzeof(blob->handle.gz);
1340+ blob->eof=gzeof(blob->handle.gz);
13361341 #endif /* defined(HasZLIB) && !defined(DISABLE_COMPRESSED_FILES) */
1337- break;
1338- }
1339- case BZipStream:
1340- {
1342+ break;
1343+ }
1344+ case BZipStream:
1345+ {
13411346 #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;
13471352 #endif /* defined(HasBZLIB) && !defined(DISABLE_COMPRESSED_FILES) */
1348- break;
1353+ break;
1354+ }
1355+ case BlobStream:
1356+ break;
1357+ }
13491358 }
1350- case BlobStream:
1351- break;
1352- }
13531359 return(blob->eof);
13541360 }
13551361
@@ -2387,7 +2393,8 @@
23872393
23882394 size_t
23892395 block_size,
2390- length;
2396+ length,
2397+ total=0;
23912398
23922399 assert(image != (Image *) NULL);
23932400 assert(image->signature == MagickSignature);
@@ -2421,6 +2428,7 @@
24212428 count=write(file,buffer+i,(MAGICK_POSIX_IO_SIZE_T) (length-i));
24222429 if (count <= 0)
24232430 break;
2431+ total += count;
24242432 }
24252433 if (i < length)
24262434 break;
@@ -2428,7 +2436,8 @@
24282436 (void) close(file);
24292437 if (image->logging)
24302438 (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);
24322441 MagickFreeMemory(buffer);
24332442 return (i < length ? MagickFail : MagickPass);
24342443 }
@@ -2711,6 +2720,11 @@
27112720 " mode %s ...", image, image->blob,
27122721 BlobModeToString(mode));
27132722 /*
2723+ Set read limits
2724+ */
2725+ image->blob->read_limit = (size_t) GetMagickResourceLimit(ReadResource);
2726+ image->blob->read_total = 0;
2727+ /*
27142728 Cache I/O block size
27152729 */
27162730 image->blob->block_size=MagickGetFileSystemBlockSize();
@@ -3152,13 +3166,14 @@
31523166 %
31533167 %
31543168 */
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)
31563170 {
31573171 BlobInfo
31583172 * restrict blob;
31593173
31603174 size_t
3161- count;
3175+ count,
3176+ length;
31623177
31633178 assert(image != (Image *) NULL);
31643179 assert(image->signature == MagickSignature);
@@ -3167,6 +3182,9 @@
31673182 assert(data != (void *) NULL);
31683183
31693184 blob=image->blob;
3185+
3186+ length=Min(req_length,blob->read_limit-blob->read_total);
3187+
31703188 count=0;
31713189 switch (blob->type)
31723190 {
@@ -3336,6 +3354,9 @@
33363354 }
33373355 }
33383356 assert(count <= length);
3357+ blob->read_total += count;
3358+ if (count == 0)
3359+ blob->eof=True;
33393360 return(count);
33403361 }
33413362
@@ -3434,6 +3455,12 @@
34343455
34353456 blob=image->blob;
34363457
3458+ if (blob->read_total >= blob->read_limit)
3459+ {
3460+ blob->eof=1;
3461+ return EOF;
3462+ }
3463+
34373464 switch (blob->type)
34383465 {
34393466 case FileStream:
@@ -3449,6 +3476,10 @@
34493476 blob->first_errno=errno;
34503477 }
34513478 }
3479+ else
3480+ {
3481+ blob->read_total++;
3482+ }
34523483 break;
34533484 }
34543485 case BlobStream:
@@ -3457,6 +3488,7 @@
34573488 {
34583489 octet=*((unsigned char *)blob->data+blob->offset);
34593490 blob->offset++;
3491+ blob->read_total++;
34603492 c=octet;
34613493 }
34623494 else
@@ -3472,6 +3504,7 @@
34723504 c=octet;
34733505 }
34743506 }
3507+
34753508 return c;
34763509 }
34773510
diff -r eae611832371 -r 121de89bed95 magick/enum_strings.c
--- a/magick/enum_strings.c Sat Jan 01 12:38:34 2022 -0600
+++ b/magick/enum_strings.c Sat Jan 08 17:14:10 2022 -0600
@@ -1,5 +1,5 @@
11 /*
2-% Copyright (C) 2008-2019 GraphicsMagick Group
2+% Copyright (C) 2008-2022 GraphicsMagick Group
33 %
44 % This program is covered by multiple licenses, which are described in
55 % Copyright.txt. You should have received a copy of Copyright.txt with this
@@ -1660,6 +1660,8 @@
16601660 resource_type=WidthResource;
16611661 else if (LocaleCompare("Height",option) == 0)
16621662 resource_type=HeightResource;
1663+ else if (LocaleCompare("Read",option) == 0)
1664+ resource_type=ReadResource;
16631665 return resource_type;
16641666 }
16651667
diff -r eae611832371 -r 121de89bed95 magick/resource.c
--- a/magick/resource.c Sat Jan 01 12:38:34 2022 -0600
+++ b/magick/resource.c Sat Jan 08 17:14:10 2022 -0600
@@ -1,5 +1,5 @@
11 /*
2-% Copyright (C) 2003 - 2019 GraphicsMagick Group
2+% Copyright (C) 2003 - 2022 GraphicsMagick Group
33 % Copyright (C) 2002 ImageMagick Studio
44 %
55 % This program is covered by multiple licenses, which are described in
@@ -96,15 +96,16 @@
9696 static ResourceInfo
9797 resource_info[] =
9898 {
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 }
108109 };
109110
110111 /*
@@ -411,7 +412,8 @@
411412 max_pixels=-1,
412413 max_threads=1,
413414 max_width=-1,
414- max_height=-1;
415+ max_height=-1,
416+ max_read=-1;
415417
416418 size_t
417419 index;
@@ -610,6 +612,9 @@
610612 if ((envp=getenv("MAGICK_LIMIT_HEIGHT")))
611613 max_height=MagickSizeStrToInt64(envp,1024);
612614
615+ if ((envp=getenv("MAGICK_LIMIT_READ")))
616+ max_read=MagickSizeStrToInt64(envp,1024);
617+
613618 #if defined(HAVE_OPENMP)
614619 max_threads=omp_get_num_procs();
615620 (void) LogMagickEvent(ResourceEvent,GetMagickModule(),
@@ -713,6 +718,8 @@
713718 (void) SetMagickResourceLimit(WidthResource,max_width);
714719 if (max_height >= 0)
715720 (void) SetMagickResourceLimit(HeightResource,max_height);
721+ if (max_read >= 0)
722+ (void) SetMagickResourceLimit(ReadResource,max_read);
716723 }
717724
718725 /*
diff -r eae611832371 -r 121de89bed95 magick/resource.h
--- a/magick/resource.h Sat Jan 01 12:38:34 2022 -0600
+++ b/magick/resource.h Sat Jan 08 17:14:10 2022 -0600
@@ -1,5 +1,5 @@
11 /*
2- Copyright (C) 2003 - 2015 GraphicsMagick Group
2+ Copyright (C) 2003 - 2022 GraphicsMagick Group
33 Copyright (C) 2002 ImageMagick Studio
44
55 This program is covered by multiple licenses, which are described in
@@ -28,7 +28,8 @@
2828 PixelsResource, /* Maximum number of pixels in single image (Pixels) */
2929 ThreadsResource, /* Maximum number of worker threads */
3030 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 */
3233 } ResourceType;
3334
3435 /*
diff -r eae611832371 -r 121de89bed95 magick/version.h
--- a/magick/version.h Sat Jan 01 12:38:34 2022 -0600
+++ b/magick/version.h Sat Jan 08 17:14:10 2022 -0600
@@ -38,8 +38,8 @@
3838 #define MagickLibVersion 0x262300
3939 #define MagickLibVersionText "1.4"
4040 #define MagickLibVersionNumber 26,23,0
41-#define MagickChangeDate "20220101"
42-#define MagickReleaseDate "snapshot-20220101"
41+#define MagickChangeDate "20220108"
42+#define MagickReleaseDate "snapshot-20220108"
4343
4444 /*
4545 The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r eae611832371 -r 121de89bed95 utilities/gm.1
--- a/utilities/gm.1 Sat Jan 01 12:38:34 2022 -0600
+++ b/utilities/gm.1 Sat Jan 08 17:14:10 2022 -0600
@@ -1,4 +1,4 @@
1-.TH gm 1 "2021/12/31" "GraphicsMagick"
1+.TH gm 1 "2022/01/08" "GraphicsMagick"
22 .TP
33 .in 15
44 .in 15
@@ -2987,28 +2987,41 @@
29872987 "Input Levels" interface.
29882988 .TP
29892989 .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
29912991
29922992 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.
30123025
30133026 The value argument is an absolute value, but may have standard binary
30143027 suffix characters applied ('K', 'M', 'G', 'T', 'P', 'E') to apply a
@@ -3022,10 +3035,11 @@
30223035 environment variables \fBMAGICK_LIMIT_DISK\fP,
30233036 \fBMAGICK_LIMIT_FILES\fP, \fBMAGICK_LIMIT_MAP\fP,
30243037 \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.
30293043
30303044 Use the option -list resource list the current limits.
30313045 .TP
@@ -5079,6 +5093,15 @@
50795093 number of pixels due to multiple image frames/pages (e.g. multi-page
50805094 document or an animation).
50815095 .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
50825105 .B "MAGICK_LIMIT_WIDTH"
50835106 \fRMaximum pixel width of an image read, or created.
50845107 .TP
@@ -5302,7 +5325,7 @@
53025325 \fRthe type of interlacing scheme
53035326 .TP
53045327 .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
53065329 .TP
53075330 .B "-log \fI<string>"\fP
53085331 \fRSpecify format for debug log
@@ -5905,7 +5928,7 @@
59055928 \fRthe type of interlacing scheme
59065929 .TP
59075930 .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
59095932 .TP
59105933 .B "-log \fI<string>"\fP
59115934 \fRSpecify format for debug log
@@ -6086,7 +6109,7 @@
60866109 \fRassign a label to an image
60876110 .TP
60886111 .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
60906113 .TP
60916114 .B "-log \fI<string>"\fP
60926115 \fRSpecify format for debug log
@@ -7105,7 +7128,7 @@
71057128 \fRadjust the level of image contrast
71067129 .TP
71077130 .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
71097132 .TP
71107133 .B "-list \fI<type>"\fP
71117134 \fRthe type of list
@@ -7620,7 +7643,7 @@
76207643 \fRassign a label to an image
76217644 .TP
76227645 .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
76247647 .TP
76257648 .B "-log \fI<string>"\fP
76267649 \fRSpecify format for debug log
@@ -9630,7 +9653,7 @@
96309653 \fRthe type of interlacing scheme
96319654 .TP
96329655 .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
96349657 .TP
96359658 .B "-log \fI<string>"\fP
96369659 \fRSpecify format for debug log
@@ -9777,7 +9800,7 @@
97779800 \fRassign a label to an image
97789801 .TP
97799802 .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
97819804 .TP
97829805 .B "-log \fI<string>"\fP
97839806 \fRSpecify format for debug log
@@ -10085,7 +10108,7 @@
1008510108 \fRadjust the level of image contrast
1008610109 .TP
1008710110 .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
1008910112 .TP
1009010113 .B "-linewidth"
1009110114 \fRthe line width for subsequent draw operations
@@ -10552,7 +10575,7 @@
1055210575 \fRassign a label to an image
1055310576 .TP
1055410577 .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
1055610579 .TP
1055710580 .B "-log \fI<string>"\fP
1055810581 \fRSpecify format for debug log
diff -r eae611832371 -r 121de89bed95 www/Changelog.html
--- a/www/Changelog.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/Changelog.html Sat Jan 08 17:14:10 2022 -0600
@@ -35,6 +35,15 @@
3535 <div class="document">
3636
3737
38+<p>2022-01-08 Bob Friesenhahn &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</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>
3847 <p>2022-01-01 Bob Friesenhahn &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
3948 <blockquote>
4049 * ChangeLog.2021: Rotate ChangeLog for 2022. Happy New Year!</blockquote>
diff -r eae611832371 -r 121de89bed95 www/GraphicsMagick.html
--- a/www/GraphicsMagick.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/GraphicsMagick.html Sat Jan 08 17:14:10 2022 -0600
@@ -3323,28 +3323,41 @@
33233323 ><font color="#00B04F"><font size="+1">
33243324 <a name="details-limit"></a>-limit <i>&lt;type&gt; &lt;value&gt;</i>
33253325 </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>
33273327 <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1">
33283328 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>
33483361 <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1">
33493362 The value argument is an absolute value, but may have standard binary
33503363 suffix characters applied ('K', 'M', 'G', 'T', 'P', 'E') to apply a
@@ -3358,10 +3371,11 @@
33583371 environment variables <strong>MAGICK_LIMIT_DISK</strong>,
33593372 <strong>MAGICK_LIMIT_FILES</strong>, <strong>MAGICK_LIMIT_MAP</strong>,
33603373 <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>
33653379 <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1">
33663380 Use the option <tt>-list resource</tt> list the current limits.</font></td></tr></table>
33673381 <table BORDER=0 WIDTH="94%">
@@ -6265,6 +6279,23 @@
62656279 ALT=">" BORDER=0 height=14
62666280 width=15><b><font face="Helvetica, Arial"
62676281 ><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">
62686299 MAGICK_LIMIT_WIDTH
62696300 </font></font></font></b></td></tr></table>
62706301 <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>
diff -r eae611832371 -r 121de89bed95 www/animate.html
--- a/www/animate.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/animate.html Sat Jan 08 17:14:10 2022 -0600
@@ -463,7 +463,7 @@
463463 ><font color="#00B04F"><font size="+1">
464464 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
465465 </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>
467467 <table BORDER=0 WIDTH="94%">
468468 <tr>
469469 <td width="3%"><br></td>
diff -r eae611832371 -r 121de89bed95 www/compare.html
--- a/www/compare.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/compare.html Sat Jan 08 17:14:10 2022 -0600
@@ -297,7 +297,7 @@
297297 ><font color="#00B04F"><font size="+1">
298298 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
299299 </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>
301301 <table BORDER=0 WIDTH="94%">
302302 <tr>
303303 <td width="3%"><br></td>
diff -r eae611832371 -r 121de89bed95 www/composite.html
--- a/www/composite.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/composite.html Sat Jan 08 17:14:10 2022 -0600
@@ -476,7 +476,7 @@
476476 ><font color="#00B04F"><font size="+1">
477477 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
478478 </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>
480480 <table BORDER=0 WIDTH="94%">
481481 <tr>
482482 <td width="3%"><br></td>
diff -r eae611832371 -r 121de89bed95 www/convert.html
--- a/www/convert.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/convert.html Sat Jan 08 17:14:10 2022 -0600
@@ -995,7 +995,7 @@
995995 ><font color="#00B04F"><font size="+1">
996996 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
997997 </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>
999999 <table BORDER=0 WIDTH="94%">
10001000 <tr>
10011001 <td width="3%"><br></td>
diff -r eae611832371 -r 121de89bed95 www/display.html
--- a/www/display.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/display.html Sat Jan 08 17:14:10 2022 -0600
@@ -731,7 +731,7 @@
731731 ><font color="#00B04F"><font size="+1">
732732 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
733733 </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>
735735 <table BORDER=0 WIDTH="94%">
736736 <tr>
737737 <td width="3%"><br></td>
diff -r eae611832371 -r 121de89bed95 www/gm.html
--- a/www/gm.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/gm.html Sat Jan 08 17:14:10 2022 -0600
@@ -3286,28 +3286,41 @@
32863286 ><font color="#00B04F"><font size="+1">
32873287 <a name="details-limit"></a>-limit <i>&lt;type&gt; &lt;value&gt;</i>
32883288 </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>
32903290 <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1">
32913291 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>
33113324 <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1">
33123325 The value argument is an absolute value, but may have standard binary
33133326 suffix characters applied ('K', 'M', 'G', 'T', 'P', 'E') to apply a
@@ -3321,10 +3334,11 @@
33213334 environment variables <strong>MAGICK_LIMIT_DISK</strong>,
33223335 <strong>MAGICK_LIMIT_FILES</strong>, <strong>MAGICK_LIMIT_MAP</strong>,
33233336 <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>
33283342 <table width="90%" border="0" cellspacing="0" cellpadding="8"> <tr><td width="6%"><br></td><td><font size="-1">
33293343 Use the option <tt>-list resource</tt> list the current limits.</font></td></tr></table>
33303344 <table BORDER=0 WIDTH="94%">
@@ -6228,6 +6242,23 @@
62286242 ALT=">" BORDER=0 height=14
62296243 width=15><b><font face="Helvetica, Arial"
62306244 ><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">
62316262 MAGICK_LIMIT_WIDTH
62326263 </font></font></font></b></td></tr></table>
62336264 <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 @@
67946825 ><font color="#00B04F"><font size="+1">
67956826 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
67966827 </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>
67986829 <table BORDER=0 WIDTH="94%">
67996830 <tr>
68006831 <td width="3%"><br></td>
@@ -7869,7 +7900,7 @@
78697900 ><font color="#00B04F"><font size="+1">
78707901 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
78717902 </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>
78737904 <table BORDER=0 WIDTH="94%">
78747905 <tr>
78757906 <td width="3%"><br></td>
@@ -8383,7 +8414,7 @@
83838414 ><font color="#00B04F"><font size="+1">
83848415 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
83858416 </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>
83878418 <table BORDER=0 WIDTH="94%">
83888419 <tr>
83898420 <td width="3%"><br></td>
@@ -10066,7 +10097,7 @@
1006610097 ><font color="#00B04F"><font size="+1">
1006710098 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
1006810099 </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>
1007010101 <table BORDER=0 WIDTH="94%">
1007110102 <tr>
1007210103 <td width="3%"><br></td>
@@ -11584,7 +11615,7 @@
1158411615 ><font color="#00B04F"><font size="+1">
1158511616 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
1158611617 </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>
1158811619 <table BORDER=0 WIDTH="94%">
1158911620 <tr>
1159011621 <td width="3%"><br></td>
@@ -14646,7 +14677,7 @@
1464614677 ><font color="#00B04F"><font size="+1">
1464714678 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
1464814679 </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>
1465014681 <table BORDER=0 WIDTH="94%">
1465114682 <tr>
1465214683 <td width="3%"><br></td>
@@ -15053,7 +15084,7 @@
1505315084 ><font color="#00B04F"><font size="+1">
1505415085 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
1505515086 </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>
1505715088 <table BORDER=0 WIDTH="94%">
1505815089 <tr>
1505915090 <td width="3%"><br></td>
@@ -16075,7 +16106,7 @@
1607516106 ><font color="#00B04F"><font size="+1">
1607616107 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
1607716108 </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>
1607916110 <table BORDER=0 WIDTH="94%">
1608016111 <tr>
1608116112 <td width="3%"><br></td>
@@ -17496,7 +17527,7 @@
1749617527 ><font color="#00B04F"><font size="+1">
1749717528 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
1749817529 </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>
1750017531 <table BORDER=0 WIDTH="94%">
1750117532 <tr>
1750217533 <td width="3%"><br></td>
diff -r eae611832371 -r 121de89bed95 www/identify.html
--- a/www/identify.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/identify.html Sat Jan 08 17:14:10 2022 -0600
@@ -246,7 +246,7 @@
246246 ><font color="#00B04F"><font size="+1">
247247 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
248248 </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>
250250 <table BORDER=0 WIDTH="94%">
251251 <tr>
252252 <td width="3%"><br></td>
diff -r eae611832371 -r 121de89bed95 www/import.html
--- a/www/import.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/import.html Sat Jan 08 17:14:10 2022 -0600
@@ -409,7 +409,7 @@
409409 ><font color="#00B04F"><font size="+1">
410410 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
411411 </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>
413413 <table BORDER=0 WIDTH="94%">
414414 <tr>
415415 <td width="3%"><br></td>
diff -r eae611832371 -r 121de89bed95 www/mogrify.html
--- a/www/mogrify.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/mogrify.html Sat Jan 08 17:14:10 2022 -0600
@@ -843,7 +843,7 @@
843843 ><font color="#00B04F"><font size="+1">
844844 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
845845 </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>
847847 <table BORDER=0 WIDTH="94%">
848848 <tr>
849849 <td width="3%"><br></td>
diff -r eae611832371 -r 121de89bed95 www/montage.html
--- a/www/montage.html Sat Jan 01 12:38:34 2022 -0600
+++ b/www/montage.html Sat Jan 08 17:14:10 2022 -0600
@@ -637,7 +637,7 @@
637637 ><font color="#00B04F"><font size="+1">
638638 <a href="GraphicsMagick.html#details-limit">-limit</a> <i>&lt;type&gt; &lt;value&gt;</i>
639639 </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>
641641 <table BORDER=0 WIDTH="94%">
642642 <tr>
643643 <td width="3%"><br></td>
Show on old repository browser