GraphicsMagick: ReadMIFFImage(): Do not proceed to next image in...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.914.1642365993.1940.graphicsmagick-commit@lists.sourceforge.net>
changeset a45a3d5e77ae in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=a45a3d5e77ae
summary: ReadMIFFImage(): Do not proceed to next image in sequence unless the character read is the expected 'i' character.

diffstat:

 ChangeLog          |  5 +++++
 coders/miff.c      |  4 ++--
 www/Changelog.html |  9 +++++++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diffs (55 lines):

diff -r 743f1bcf3052 -r a45a3d5e77ae ChangeLog
--- a/ChangeLog	Sun Jan 16 11:57:59 2022 -0600
+++ b/ChangeLog	Sun Jan 16 14:46:19 2022 -0600
@@ -1,5 +1,10 @@
 2022-01-16  Bob Friesenhahn  <[email protected]>
 
+        * coders/miff.c (ReadMIFFImage): Do not proceed to next image in
+        sequence unless the character read is the expected 'i' character.
+        Inspired by GraphicsMagick bug #659 "Can not escape $0 in a batch
+        command".
+
         * coders/heif.c (ReadHEIFImage): Take row stride into account when
         reading pixel rows. Add support for 'ping' mode.  Add header magic
         detection.  Add module aliases.  Add useful traces.
diff -r 743f1bcf3052 -r a45a3d5e77ae coders/miff.c
--- a/coders/miff.c	Sun Jan 16 11:57:59 2022 -0600
+++ b/coders/miff.c	Sun Jan 16 14:46:19 2022 -0600
@@ -2007,7 +2007,7 @@
     {
       c=ReadBlobByte(image);
     } while (!isgraph(c) && (c != EOF));
-    if (c != EOF)
+    if (c != EOF && ((c == 'i') || (c == 'I')))
       {
         /*
           Allocate next image structure.
@@ -2025,7 +2025,7 @@
         if (status == MagickFail)
           break;
       }
-  } while (c != EOF);
+  } while (c != EOF && ((c == 'i') || (c == 'I')));
   while (image->previous != (Image *) NULL)
     image=image->previous;
   CloseBlob(image);
diff -r 743f1bcf3052 -r a45a3d5e77ae www/Changelog.html
--- a/www/Changelog.html	Sun Jan 16 11:57:59 2022 -0600
+++ b/www/Changelog.html	Sun Jan 16 14:46:19 2022 -0600
@@ -37,9 +37,14 @@
 
 <p>2022-01-16  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/heif.c (ReadHEIFImage): Take row stride into account when
+<p>* coders/miff.c (ReadMIFFImage): Do not proceed to next image in
+sequence unless the character read is the expected 'i' character.
+Inspired by GraphicsMagick bug #659 &quot;Can not escape $0 in a batch
+command&quot;.</p>
+<p>* coders/heif.c (ReadHEIFImage): Take row stride into account when
 reading pixel rows. Add support for 'ping' mode.  Add header magic
-detection.  Add module aliases.  Add useful traces.</blockquote>
+detection.  Add module aliases.  Add useful traces.</p>
+</blockquote>
 <p>2022-01-15  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/jxl.c: Added preliminary JPEG XL support written by
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.