GraphicsMagick: ReadJP2Image(): Always use ThrowJP2ReaderExcepti...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.4956.1642956587.1607.graphicsmagick-commit@lists.sourceforge.net>
changeset a0d5ac0d75c1 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=a0d5ac0d75c1
summary: ReadJP2Image(): Always use ThrowJP2ReaderException().

diffstat:

 ChangeLog                              |   7 +++++++
 VisualMagick/installer/inc/version.isx |   4 ++--
 coders/jp2.c                           |  15 +++++++--------
 magick/version.h                       |   4 ++--
 www/Changelog.html                     |  10 ++++++++++
 5 files changed, 28 insertions(+), 12 deletions(-)

diffs (126 lines):

diff -r bb05e046dbc1 -r a0d5ac0d75c1 ChangeLog
--- a/ChangeLog	Sat Jan 22 14:38:19 2022 -0600
+++ b/ChangeLog	Sun Jan 23 10:49:35 2022 -0600
@@ -1,3 +1,10 @@
+2022-01-23  Bob Friesenhahn  <[email protected]>
+
+        * coders/jp2.c (ReadJP2Image): Always use
+        ThrowJP2ReaderException().  Should address oss-fuzz Issue 43979:
+        "graphicsmagick:enhance_fuzzer: ASSERT: jas_get_ctx() ==
+        jas_global.ctx".
+
 2022-01-22  Bob Friesenhahn  <[email protected]>
 
         * utilities/tests: Write compressed MIFF files to reduce disk
diff -r bb05e046dbc1 -r a0d5ac0d75c1 VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Sat Jan 22 14:38:19 2022 -0600
+++ b/VisualMagick/installer/inc/version.isx	Sun Jan 23 10:49:35 2022 -0600
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020220122"
-#define public MagickPackageReleaseDate "snapshot-20220122"
+#define public MagickPackageVersionAddendum ".020220123"
+#define public MagickPackageReleaseDate "snapshot-20220123"
diff -r bb05e046dbc1 -r a0d5ac0d75c1 coders/jp2.c
--- a/coders/jp2.c	Sat Jan 22 14:38:19 2022 -0600
+++ b/coders/jp2.c	Sun Jan 23 10:49:35 2022 -0600
@@ -704,7 +704,7 @@
   image=AllocateImage(image_info);
   status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
   if (status == False)
-    ThrowReaderException(FileOpenError,UnableToOpenFile,image);
+    ThrowJP2ReaderException(FileOpenError,UnableToOpenFile,image);
 
   (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                         "Requested format is \"%s\"",
@@ -729,14 +729,13 @@
     /* Read header */
     if ((magick_length=ReadBlob(image,sizeof(magick),magick)) != sizeof(magick))
       {
-        ThrowReaderException(CorruptImageError,UnexpectedEndOfFile,
-                             image);
+        ThrowJP2ReaderException(CorruptImageError,UnexpectedEndOfFile,image);
       }
 
     /* Restore seek position */
     if (SeekBlob(image,pos,SEEK_SET) != pos)
       {
-        ThrowReaderException(BlobError,UnableToSeekToOffset,image);
+        ThrowJP2ReaderException(BlobError,UnableToSeekToOffset,image);
       }
 
     /* Inspect header to see what it might actually be */
@@ -755,7 +754,7 @@
       {
         (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                               "Not a \"%s\" file!", image_info->magick);
-        ThrowReaderException(CorruptImageError,ImproperImageHeader,image);
+        ThrowJP2ReaderException(CorruptImageError,ImproperImageHeader,image);
       }
 
     /*
@@ -765,7 +764,7 @@
       {
         (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                               "Header is not a supported type for this coder");
-        ThrowReaderException(CorruptImageError,ImproperImageHeader,image);
+        ThrowJP2ReaderException(CorruptImageError,ImproperImageHeader,image);
       }
 
     /*
@@ -775,7 +774,7 @@
          (const MagickInfo *) NULL) ||
         (magick_info->decoder == (DecoderHandler) NULL))
       {
-        ThrowReaderException(DelegateError,UnableToDecodeImageFile,image);
+        ThrowJP2ReaderException(DelegateError,UnableToDecodeImageFile,image);
       }
   }
 
@@ -784,7 +783,7 @@
   */
   jp2_stream=JP2StreamManager(&StreamOperators, image);
   if (jp2_stream == (jas_stream_t *) NULL)
-    ThrowReaderException(DelegateError,UnableToManageJP2Stream,image);
+    ThrowJP2ReaderException(DelegateError,UnableToManageJP2Stream,image);
 
   /*
     Support passing Jasper options.
diff -r bb05e046dbc1 -r a0d5ac0d75c1 magick/version.h
--- a/magick/version.h	Sat Jan 22 14:38:19 2022 -0600
+++ b/magick/version.h	Sun Jan 23 10:49:35 2022 -0600
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x262300
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 26,23,0
-#define MagickChangeDate   "20220122"
-#define MagickReleaseDate  "snapshot-20220122"
+#define MagickChangeDate   "20220123"
+#define MagickReleaseDate  "snapshot-20220123"
 
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r bb05e046dbc1 -r a0d5ac0d75c1 www/Changelog.html
--- a/www/Changelog.html	Sat Jan 22 14:38:19 2022 -0600
+++ b/www/Changelog.html	Sun Jan 23 10:49:35 2022 -0600
@@ -35,8 +35,18 @@
 <div class="document">
 
 
+<p>2022-01-23  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>
+* coders/jp2.c (ReadJP2Image): Always use
+ThrowJP2ReaderException().  Should address oss-fuzz Issue 43979:
+&quot;graphicsmagick:enhance_fuzzer: ASSERT: jas_get_ctx() ==
+jas_global.ctx&quot;.</blockquote>
 <p>2022-01-22  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>
+<p>* utilities/tests: Write compressed MIFF files to reduce disk
+space usage.</p>
+<p>* magick/command.c (CompareImageCommand): Support '-compress'
+option.</p>
 <p>* coders/mpc.c: Fix warnings from GCC 11.</p>
 <p>* coders/miff.c: Fix warnings from GCC 11.</p>
 </blockquote>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.