GraphicsMagick: 2 new changesets

GraphicsMagick Commits <[email protected]> Mon, 09 Sep 2024 08:02:04 -0500
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.19838.1725886938.7812.graphicsmagick-commit@lists.sourceforge.net>
changeset db3ff8d00c28 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=db3ff8d00c28
summary: Further updates to color specification documentation.

changeset 9bbae7314e3c in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=9bbae7314e3c
summary: ReadJXLImage(): Apply image dimension resource limits. Addresses oss-fuzz Issue 69728

diffstat:

 ChangeLog                              |  12 ++++++++++++
 VisualMagick/installer/inc/version.isx |   4 ++--
 coders/jxl.c                           |   4 ++++
 doc/options.imdoc                      |  12 ++++++++----
 magick/color_lookup.c                  |  19 ++++++++++++++++++-
 magick/version.h                       |   4 ++--
 utilities/gm.1                         |  14 +++++++++-----
 www/ChangeLog.html                     |  13 +++++++++++++
 www/GraphicsMagick.html                |  12 ++++++++----
 www/gm.html                            |  12 ++++++++----
 10 files changed, 84 insertions(+), 22 deletions(-)

diffs (258 lines):

diff -r dd98fe34ba8d -r 9bbae7314e3c ChangeLog
--- a/ChangeLog	Sat Sep 07 09:17:25 2024 -0500
+++ b/ChangeLog	Mon Sep 09 08:01:43 2024 -0500
@@ -1,5 +1,17 @@
+2024-09-09  Bob Friesenhahn  <[email protected]>
+
+	* coders/jxl.c (ReadJXLImage): Apply image dimension resource
+	limits. Addresses oss-fuzz Issue 69728:
+	"graphicsmagick:coder_TIFF_any_fuzzer: Out-of-memory in
+	coder_TIFF_any_fuzzer".
+
 2024-09-07  Bob Friesenhahn  <[email protected]>
 
+	* doc/options.imdoc: Further updates to color specification
+	documentation, based on what the current code is
+	doing. Unfortunately, current behavior deviates from CSS3 in some
+	aspects.
+
 	* fuzzing/oss-fuzz-build.sh: Libtiff build now requires
 	autoconf-archive
 
diff -r dd98fe34ba8d -r 9bbae7314e3c VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Sat Sep 07 09:17:25 2024 -0500
+++ b/VisualMagick/installer/inc/version.isx	Mon Sep 09 08:01:43 2024 -0500
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020240907"
-#define public MagickPackageReleaseDate "snapshot-20240907"
+#define public MagickPackageVersionAddendum ".020240909"
+#define public MagickPackageReleaseDate "snapshot-20240909"
diff -r dd98fe34ba8d -r 9bbae7314e3c coders/jxl.c
--- a/coders/jxl.c	Sat Sep 07 09:17:25 2024 -0500
+++ b/coders/jxl.c	Mon Sep 09 08:01:43 2024 -0500
@@ -571,6 +571,7 @@
                                       basic_info.alpha_bits, basic_info.num_color_channels,
                                       basic_info.have_animation == JXL_FALSE ? "False" : "True");
               }
+
             if (basic_info.num_extra_channels)
               {
                 size_t index;
@@ -637,6 +638,9 @@
 
             image->orientation=convert_orientation(basic_info.orientation);
 
+            if (CheckImagePixelLimits(image, exception) != MagickPass)
+              ThrowJXLReaderException(ResourceLimitError,ImagePixelLimitExceeded,image);
+
             pixel_format.endianness=JXL_NATIVE_ENDIAN;
             pixel_format.align=0;
             if (basic_info.num_color_channels == 1)
diff -r dd98fe34ba8d -r 9bbae7314e3c doc/options.imdoc
--- a/doc/options.imdoc	Sat Sep 07 09:17:25 2024 -0500
+++ b/doc/options.imdoc	Mon Sep 09 08:01:43 2024 -0500
@@ -2230,8 +2230,10 @@
 
 <abs>color to use when filling a graphic primitive</abs>
 
-<pp>
-Colors are represented in GraphicsMagick in a form similar to SVG. Use "gm convert -list color" to list named colors:</pp>
+<pp> Numeric colors specifications in GraphicsMagick are similar to
+RGB and RGBA color values as used by SVG and CSS Color Module Level 3
+(https://www.w3.org/TR/css-color-3/#numerical). Use "gm convert -list
+color" to list named colors:</pp>
 
 <pp><pre>
     name                              (named color)
@@ -2244,8 +2246,10 @@
     #RRGGBBAA                         (8 bits each)
     #RRRRRRGGGGGGBBBBBB               (12 bits each)
     #RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA (32 bits each)
-    rgb(r,g,b)                        (r,g,b are decimal numbers, range 0 to 255)
-    rgba(r,g,b,a)                     (r,g,b,a are decimal numbers, range 0 to 255)
+    rgb(r,g,b)                        (r,g,b are decimal numbers, range 0 to QuantumDepth)
+    rgb(r%,g%,b%)                     (r,g,b are decimal numbers, range 0 to 100%)
+    rgba(r,g,b,a)                     (r,g,b,a are decimal numbers, range 0 to QuantumDepth)
+    rgba(r%,g%,b%,a%)                 (r,g,b,a are decimal numbers, range 0 to 100%)
 </pre></pp>
 <pp>
 Enclose the color specification in quotation marks to prevent the "#"
diff -r dd98fe34ba8d -r 9bbae7314e3c magick/color_lookup.c
--- a/magick/color_lookup.c	Sat Sep 07 09:17:25 2024 -0500
+++ b/magick/color_lookup.c	Mon Sep 09 08:01:43 2024 -0500
@@ -1107,7 +1107,10 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
 %  QueryColorDatabase() returns the red, green, blue, and opacity intensities
-%  for a given color name.
+%  for a given color name.  The color specification syntax is a superset of
+%  what is specified in the CSS Color Module Level 3
+% (https://www.w3.org/TR/css-color-3/#rgb-color), which uses the same syntax
+%  as SVG2.
 %
 %  The format of the QueryColorDatabase method is:
 %
@@ -1262,6 +1265,12 @@
       int
         count;
 
+      /*
+        FIXME: Deviates from CSS-3 specification
+
+        CSS-3 uses RGB integer range 0-255, if not percentage.
+      */
+
       scale=strchr(name,'%') == (char *) NULL ? 1.0 :
         ScaleQuantumToChar(MaxRGB)/100.0;
       pixel.red=pixel.green=pixel.blue=0.0;
@@ -1284,6 +1293,14 @@
       int
         count;
 
+      /*
+        FIXME: Deviates from CSS-3 specification
+
+        CSS-3 uses RGB integer range 0-255, if not percentage.
+        CSS-3 uses non-percent decimal values for Alpha.
+        CSS-3 uses a value 0 to mean totally transparent.
+      */
+
       scale=strchr(name,'%') == (char *) NULL ? 1.0 :
         ScaleQuantumToChar(MaxRGB)/100.0;
       pixel.red=pixel.green=pixel.blue=0.0;
diff -r dd98fe34ba8d -r 9bbae7314e3c magick/version.h
--- a/magick/version.h	Sat Sep 07 09:17:25 2024 -0500
+++ b/magick/version.h	Mon Sep 09 08:01:43 2024 -0500
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x282502
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 28,25,2
-#define MagickChangeDate   "20240907"
-#define MagickReleaseDate  "snapshot-20240907"
+#define MagickChangeDate   "20240909"
+#define MagickReleaseDate  "snapshot-20240909"
 
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r dd98fe34ba8d -r 9bbae7314e3c utilities/gm.1
--- a/utilities/gm.1	Sat Sep 07 09:17:25 2024 -0500
+++ b/utilities/gm.1	Mon Sep 09 08:01:43 2024 -0500
@@ -1,4 +1,4 @@
-.TH gm 1 "2024/09/06" "GraphicsMagick"
+.TH gm 1 "2024/09/07" "GraphicsMagick"
 .TP
 .in 15
 .in 15
@@ -2384,8 +2384,10 @@
 .TP
 .B "-fill \fI<color>"\fP
 \fRcolor to use when filling a graphic primitive
-
-Colors are represented in GraphicsMagick in a form similar to SVG. Use "gm convert -list color" to list named colors:
+ Numeric colors specifications in GraphicsMagick are similar to
+RGB and RGBA color values as used by SVG and CSS Color Module Level 3
+(https://www.w3.org/TR/css-color-3/#numerical). Use "gm convert -list
+color" to list named colors:
 
 .nf
     name                              (named color)
@@ -2398,8 +2400,10 @@
     #RRGGBBAA                         (8 bits each)
     #RRRRRRGGGGGGBBBBBB               (12 bits each)
     #RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA (32 bits each)
-    rgb(r,g,b)                        (r,g,b are decimal numbers, range 0 to 255)
-    rgba(r,g,b,a)                     (r,g,b,a are decimal numbers, range 0 to 255)
+    rgb(r,g,b)                        (r,g,b are decimal numbers, range 0 to QuantumDepth)
+    rgb(r%,g%,b%)                     (r,g,b are decimal numbers, range 0 to 100%)
+    rgba(r,g,b,a)                     (r,g,b,a are decimal numbers, range 0 to QuantumDepth)
+    rgba(r%,g%,b%,a%)                 (r,g,b,a are decimal numbers, range 0 to 100%)
 .fi
 
 Enclose the color specification in quotation marks to prevent the "#"
diff -r dd98fe34ba8d -r 9bbae7314e3c www/ChangeLog.html
--- a/www/ChangeLog.html	Sat Sep 07 09:17:25 2024 -0500
+++ b/www/ChangeLog.html	Mon Sep 09 08:01:43 2024 -0500
@@ -38,9 +38,22 @@
 
 <main id="graphicsmagick-changelog">
 <h1 class="title">GraphicsMagick ChangeLog</h1>
+<p>2024-09-09  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>
+<blockquote>
+<ul class="simple">
+<li><p>coders/jxl.c (ReadJXLImage): Apply image dimension resource
+limits. Addresses oss-fuzz Issue 69728:
+&quot;graphicsmagick:coder_TIFF_any_fuzzer: Out-of-memory in
+coder_TIFF_any_fuzzer&quot;.</p></li>
+</ul>
+</blockquote>
 <p>2024-09-07  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>
 <blockquote>
 <ul class="simple">
+<li><p>doc/options.imdoc: Further updates to color specification
+documentation, based on what the current code is
+doing. Unfortunately, current behavior deviates from CSS3 in some
+aspects.</p></li>
 <li><p>fuzzing/oss-fuzz-build.sh: Libtiff build now requires
 autoconf-archive</p></li>
 </ul>
diff -r dd98fe34ba8d -r 9bbae7314e3c www/GraphicsMagick.html
--- a/www/GraphicsMagick.html	Sat Sep 07 09:17:25 2024 -0500
+++ b/www/GraphicsMagick.html	Mon Sep 09 08:01:43 2024 -0500
@@ -2454,8 +2454,10 @@
     <a name="details-fill"></a>-fill <i>&lt;color&gt;</i>
 </font></font></font></b></td></tr></table>
 <table width="90%" border="0" cellspacing="0"              cellpadding="8">              <tr><td width="6%"><br></td><td>color to use when filling a graphic primitive</td></tr></table>
-<table width="90%" border="0" cellspacing="0"             cellpadding="8">             <tr><td width="6%"><br></td><td><font size="-1">
-Colors are represented in GraphicsMagick in a form similar to SVG. Use "gm convert -list color" to list named colors:</font></td></tr></table>
+<table width="90%" border="0" cellspacing="0"             cellpadding="8">             <tr><td width="6%"><br></td><td><font size="-1"> Numeric colors specifications in GraphicsMagick are similar to
+RGB and RGBA color values as used by SVG and CSS Color Module Level 3
+(https://www.w3.org/TR/css-color-3/#numerical). Use "gm convert -list
+color" to list named colors:</font></td></tr></table>
 <table width="90%" border="0" cellspacing="0"             cellpadding="8">             <tr><td width="6%"><br></td><td><font size="-1"><pre>
     name                              (named color)
     #RGB                              (hex numbers, 4 bits each)
@@ -2467,8 +2469,10 @@
     #RRGGBBAA                         (8 bits each)
     #RRRRRRGGGGGGBBBBBB               (12 bits each)
     #RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA (32 bits each)
-    rgb(r,g,b)                        (r,g,b are decimal numbers, range 0 to 255)
-    rgba(r,g,b,a)                     (r,g,b,a are decimal numbers, range 0 to 255)
+    rgb(r,g,b)                        (r,g,b are decimal numbers, range 0 to QuantumDepth)
+    rgb(r%,g%,b%)                     (r,g,b are decimal numbers, range 0 to 100%)
+    rgba(r,g,b,a)                     (r,g,b,a are decimal numbers, range 0 to QuantumDepth)
+    rgba(r%,g%,b%,a%)                 (r,g,b,a are decimal numbers, range 0 to 100%)
 </pre></font></td></tr></table>
 <table width="90%" border="0" cellspacing="0"             cellpadding="8">             <tr><td width="6%"><br></td><td><font size="-1">
 Enclose the color specification in quotation marks to prevent the "#"
diff -r dd98fe34ba8d -r 9bbae7314e3c www/gm.html
--- a/www/gm.html	Sat Sep 07 09:17:25 2024 -0500
+++ b/www/gm.html	Mon Sep 09 08:01:43 2024 -0500
@@ -2417,8 +2417,10 @@
     <a name="details-fill"></a>-fill <i>&lt;color&gt;</i>
 </font></font></font></b></td></tr></table>
 <table width="90%" border="0" cellspacing="0"              cellpadding="8">              <tr><td width="6%"><br></td><td>color to use when filling a graphic primitive</td></tr></table>
-<table width="90%" border="0" cellspacing="0"             cellpadding="8">             <tr><td width="6%"><br></td><td><font size="-1">
-Colors are represented in GraphicsMagick in a form similar to SVG. Use "gm convert -list color" to list named colors:</font></td></tr></table>
+<table width="90%" border="0" cellspacing="0"             cellpadding="8">             <tr><td width="6%"><br></td><td><font size="-1"> Numeric colors specifications in GraphicsMagick are similar to
+RGB and RGBA color values as used by SVG and CSS Color Module Level 3
+(https://www.w3.org/TR/css-color-3/#numerical). Use "gm convert -list
+color" to list named colors:</font></td></tr></table>
 <table width="90%" border="0" cellspacing="0"             cellpadding="8">             <tr><td width="6%"><br></td><td><font size="-1"><pre>
     name                              (named color)
     #RGB                              (hex numbers, 4 bits each)
@@ -2430,8 +2432,10 @@
     #RRGGBBAA                         (8 bits each)
     #RRRRRRGGGGGGBBBBBB               (12 bits each)
     #RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA (32 bits each)
-    rgb(r,g,b)                        (r,g,b are decimal numbers, range 0 to 255)
-    rgba(r,g,b,a)                     (r,g,b,a are decimal numbers, range 0 to 255)
+    rgb(r,g,b)                        (r,g,b are decimal numbers, range 0 to QuantumDepth)
+    rgb(r%,g%,b%)                     (r,g,b are decimal numbers, range 0 to 100%)
+    rgba(r,g,b,a)                     (r,g,b,a are decimal numbers, range 0 to QuantumDepth)
+    rgba(r%,g%,b%,a%)                 (r,g,b,a are decimal numbers, range 0 to 100%)
 </pre></font></td></tr></table>
 <table width="90%" border="0" cellspacing="0"             cellpadding="8">             <tr><td width="6%"><br></td><td><font size="-1">
 Enclose the color specification in quotation marks to prevent the "#"