[prev in list] [next in list] [prev in thread] [next in thread] 

List:       graphicsmagick-commit
Subject:    [GM-commit] GraphicsMagick: MIFF reader changes to deal with RLE Gray Direct...
From:       GraphicsMagick Commits <graphicsmagick-commit () lists ! sourceforge ! net>
Date:       2020-12-17 15:12:55
Message-ID: mailman.275103.1608217993.1370.graphicsmagick-commit () lists ! sourceforge ! net
[Download RAW message or body]

changeset 472c6cd581ca in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=472c6cd581ca
                
summary: MIFF reader changes to deal with RLE Gray DirectClass, but also return \
PseudoClass Gray instead.

diffstat:

 ChangeLog                              |   8 ++++++
 VisualMagick/installer/inc/version.isx |   4 +-
 coders/miff.c                          |  39 ++++++++++++++++++++++++++++-----
 magick/version.h                       |   4 +-
 www/Changelog.html                     |  10 ++++++++
 5 files changed, 55 insertions(+), 10 deletions(-)

diffs (117 lines):

diff -r e0f4cb67e57c -r 472c6cd581ca ChangeLog
--- a/ChangeLog	Tue Dec 15 07:43:26 2020 -0600
+++ b/ChangeLog	Thu Dec 17 09:12:52 2020 -0600
@@ -1,3 +1,11 @@
+2020-12-17  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* coders/miff.c (ImportRLEPixels): Change from C assertion to
+	exception report.  Fixes oss-fuzz 28703 "ASSERT  · ((quantum_type
+	== IndexQuantum) && (image->storage_class ...".
+	(ReadMIFFImage): Read Gray DirectClass image as PseudoClass so it
+	has a colormap, and we have a RLE decode implementation for it.
+
 2020-12-15  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
 
 	* magick/paint.c (OpaqueImage): Changing the image storage class
diff -r e0f4cb67e57c -r 472c6cd581ca VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Tue Dec 15 07:43:26 2020 -0600
+++ b/VisualMagick/installer/inc/version.isx	Thu Dec 17 09:12:52 2020 -0600
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020201215"
-#define public MagickPackageReleaseDate "snapshot-20201215"
+#define public MagickPackageVersionAddendum ".020201217"
+#define public MagickPackageReleaseDate "snapshot-20201217"
diff -r e0f4cb67e57c -r 472c6cd581ca coders/miff.c
--- a/coders/miff.c	Tue Dec 15 07:43:26 2020 -0600
+++ b/coders/miff.c	Thu Dec 17 09:12:52 2020 -0600
@@ -170,13 +170,29 @@
   assert(image != (Image *) NULL);
   assert(image->signature == MagickSignature);
   assert(source != (const unsigned char *) NULL);
+
+  /*
+    FIXME: gray DirectClass pixels (quantum_type=GrayQuantum and
+    GrayAlphaQuantum ) should be properly supported with RLE since
+    modern ImageMagick supports it.  For the moment we support it by
+    reading as PseudoClass using IndexQuantum.
+   */
   assert((quantum_size == 8) || (quantum_size == 16) || (quantum_size == 32));
-  assert(((quantum_type == IndexQuantum) && (image->storage_class == PseudoClass)) \
                ||
-         ((quantum_type == IndexAlphaQuantum) && (image->storage_class == \
                PseudoClass)) ||
-         ((quantum_type == CMYKAQuantum) && (image->storage_class == DirectClass) && \
                image->matte) ||
-         ((quantum_type == CMYKQuantum) && (image->storage_class == DirectClass) && \
                !image->matte) ||
-         ((quantum_type == RGBAQuantum) && (image->storage_class == DirectClass) && \
                image->matte) ||
-         ((quantum_type == RGBQuantum) && (image->storage_class == DirectClass) && \
!image->matte)); +  if (!(((quantum_type == IndexQuantum) && (image->storage_class == \
PseudoClass)) || +        ((quantum_type == IndexAlphaQuantum) && \
(image->storage_class == PseudoClass)) || +        /*  ((quantum_type == GrayQuantum) \
&& (image->storage_class == DirectClass) && !image->matte) ||*/ +        /*  \
((quantum_type == GrayAlphaQuantum) && (image->storage_class == DirectClass) && \
image->matte) ||*/ +        ((quantum_type == CMYKAQuantum) && (image->storage_class \
== DirectClass) && image->matte) || +        ((quantum_type == CMYKQuantum) && \
(image->storage_class == DirectClass) && !image->matte) || +        ((quantum_type == \
RGBAQuantum) && (image->storage_class == DirectClass) && image->matte) || +        \
((quantum_type == RGBQuantum) && (image->storage_class == DirectClass) && \
!image->matte))) +    {
+      (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+                            "RLE decompression not supported for QuantumType=%s, \
ClassType=%s, Matte=%s", +                            \
QuantumTypeToString(quantum_type),ClassTypeToString(image->storage_class), +          \
image->matte ? "True" : "False"); +      \
ThrowBinaryException(CoderError,RLECompressionNotSupported,image->filename); +    }
 
   p=source;
   q=AccessMutablePixels(image);
@@ -1606,6 +1622,17 @@
               quantum_type=RGBAQuantum;
           }
       }
+    if ((quantum_type == GrayQuantum) && (MaxValueGivenBits(depth) <= MaxMap))
+      {
+        /*
+          Create image colormap and read grey image as PseudoClass.
+        */
+        if (!AllocateImageColormap(image,MaxValueGivenBits(depth)+1))
+          ThrowMIFFReaderException(ResourceLimitError,MemoryAllocationFailed,
+                                   image);
+        quantum_type=IndexQuantum;
+      }
+
      /*
       Allocate image pixels.
     */
diff -r e0f4cb67e57c -r 472c6cd581ca magick/version.h
--- a/magick/version.h	Tue Dec 15 07:43:26 2020 -0600
+++ b/magick/version.h	Thu Dec 17 09:12:52 2020 -0600
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x242100
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 24,21,0
-#define MagickChangeDate   "20201215"
-#define MagickReleaseDate  "snapshot-20201215"
+#define MagickChangeDate   "20201217"
+#define MagickReleaseDate  "snapshot-20201217"
 
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r e0f4cb67e57c -r 472c6cd581ca www/Changelog.html
--- a/www/Changelog.html	Tue Dec 15 07:43:26 2020 -0600
+++ b/www/Changelog.html	Thu Dec 17 09:12:52 2020 -0600
@@ -35,6 +35,16 @@
 <div class="document">
 
 
+<p>2020-12-17  Bob Friesenhahn  &lt;<a class="reference external" \
href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#6 \
4;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 +<blockquote>
+<ul class="simple">
+<li>coders/miff.c (ImportRLEPixels): Change from C assertion to
+exception report.  Fixes oss-fuzz 28703 &quot;ASSERT  · ((quantum_type
+== IndexQuantum) &amp;&amp; (image-&gt;storage_class ...&quot;.
+(ReadMIFFImage): Read Gray DirectClass image as PseudoClass so it
+has a colormap, and we have a RLE decode implementation for it.</li>
+</ul>
+</blockquote>
 <p>2020-12-15  Bob Friesenhahn  &lt;<a class="reference external" \
href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#6 \
4;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
  <blockquote>
 <ul class="simple">


_______________________________________________
Graphicsmagick-commit mailing list
Graphicsmagick-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic