GraphicsMagick: ProcessMSLScript(): Fix possible use of freed me...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.81813.1624830458.1299.graphicsmagick-commit@lists.sourceforge.net>
changeset 9a4f79aabbc0 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=9a4f79aabbc0
summary: ProcessMSLScript(): Fix possible use of freed memory.

diffstat:

 ChangeLog                         |  4 ++++
 coders/msl.c                      |  2 ++
 utilities/tests/msl_composite.tap |  4 ++--
 www/Changelog.html                |  8 ++++++--
 4 files changed, 14 insertions(+), 4 deletions(-)

diffs (65 lines):

diff -r 1c0d23195a82 -r 9a4f79aabbc0 ChangeLog
--- a/ChangeLog	Sun Jun 27 09:14:38 2021 -0500
+++ b/ChangeLog	Sun Jun 27 16:47:17 2021 -0500
@@ -1,5 +1,9 @@
 2021-06-27  Bob Friesenhahn  <[email protected]>
 
+        * coders/msl.c (ProcessMSLScript): Fix possible use of freed
+        memory.  Fixes oss-fuzz 35621 "graphicsmagick:coder_MSL_fuzzer:
+        ASSERT: image->signature == MagickSignature".
+
         * fuzzing/oss-fuzz-build.sh: Disable reading and writing of
         gzip/bzip files since we don't have a viable solution for formats
         which require an uncompressed file as input.
diff -r 1c0d23195a82 -r 9a4f79aabbc0 coders/msl.c
--- a/coders/msl.c	Sun Jun 27 09:14:38 2021 -0500
+++ b/coders/msl.c	Sun Jun 27 16:47:17 2021 -0500
@@ -4951,6 +4951,8 @@
 
  msl_info_error:
 
+  msl_image=msl_info.image[0];
+
   /*
     Capture any exception which might have been reported to MSL file
     image.
diff -r 1c0d23195a82 -r 9a4f79aabbc0 utilities/tests/msl_composite.tap
--- a/utilities/tests/msl_composite.tap	Sun Jun 27 09:14:38 2021 -0500
+++ b/utilities/tests/msl_composite.tap	Sun Jun 27 16:47:17 2021 -0500
@@ -20,7 +20,7 @@
 COMPARE_CMD="${GM} compare"
 DISPLAY_CMD="${GM} display"
 
-FORMAT="_out.pnm"
+FORMAT=".miff"
 
 BLANK="comp_blank$FORMAT"
 CENTER="comp_Center$FORMAT"
@@ -147,7 +147,7 @@
 if test $status -eq 0
 then
   rm -f $TEMPFILE $BLANK $CENTER $NORTH $NORTHEAST $EAST $SOUTHEAST $SOUTH \
-    $SOUTHWEST $WEST $NORTHWEST $RESULT $CONJURE_RESULT
+    $SOUTHWEST $WEST $NORTHWEST $RESULT
 fi
 #diff --report-identical-files $RESULT $CONJURE_RESULT
 #$COMPARE_CMD $RESULT $CONJURE_RESULT $COMPARED || exit 5
diff -r 1c0d23195a82 -r 9a4f79aabbc0 www/Changelog.html
--- a/www/Changelog.html	Sun Jun 27 09:14:38 2021 -0500
+++ b/www/Changelog.html	Sun Jun 27 16:47:17 2021 -0500
@@ -37,9 +37,13 @@
 
 <p>2021-06-27  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>
-* fuzzing/oss-fuzz-build.sh: Disable reading and writing of
+<p>* coders/msl.c (ProcessMSLScript): Fix possible use of freed
+memory.  Fixes oss-fuzz 35621 &quot;graphicsmagick:coder_MSL_fuzzer:
+ASSERT: image-&gt;signature == MagickSignature&quot;.</p>
+<p>* fuzzing/oss-fuzz-build.sh: Disable reading and writing of
 gzip/bzip files since we don't have a viable solution for formats
-which require an uncompressed file as input.</blockquote>
+which require an uncompressed file as input.</p>
+</blockquote>
 <p>2021-06-26  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>* coders/pcx.c (ReadPCXImage): Fix problem that 16-colors are used
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.