GraphicsMagick: JPEG: Add tracing and fallback for longjmp().

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.1719.1641942184.1336.graphicsmagick-commit@lists.sourceforge.net>
changeset a7db52b75ed2 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=a7db52b75ed2
summary: JPEG: Add tracing and fallback for longjmp().

diffstat:

 ChangeLog          |   2 ++
 coders/jpeg.c      |  13 +++++++++++--
 www/Changelog.html |   6 ++++--
 3 files changed, 17 insertions(+), 4 deletions(-)

diffs (81 lines):

diff -r 241c653c42ad -r a7db52b75ed2 ChangeLog
--- a/ChangeLog	Tue Jan 11 17:00:24 2022 -0600
+++ b/ChangeLog	Tue Jan 11 17:02:55 2022 -0600
@@ -1,5 +1,7 @@
 2022-01-11  Bob Friesenhahn  <[email protected]>
 
+        * coders/jpeg.c: Add tracing and fallback for longjmp().
+
         * coders/pict.c (DecodeImage): Assure that the claimed scanline
         length is within the bounds of the scanline allocation to avoid
         possible heap overflow.
diff -r 241c653c42ad -r a7db52b75ed2 coders/jpeg.c
--- a/coders/jpeg.c	Tue Jan 11 17:00:24 2022 -0600
+++ b/coders/jpeg.c	Tue Jan 11 17:02:55 2022 -0600
@@ -1,5 +1,5 @@
 /*
-% Copyright (C) 2003-2021 GraphicsMagick Group
+% Copyright (C) 2003-2022 GraphicsMagick Group
 % Copyright (C) 2002 ImageMagick Studio
 % Copyright 1991-1999 E. I. du Pont de Nemours and Company
 %
@@ -372,7 +372,10 @@
         {
           ThrowException2(&image->exception,CorruptImageError,(char *) message,
                           image->filename);
+          (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+                                "Longjmp error recovery");
           longjmp(client_data->error_recovery,1);
+          SignalHandlerExit(EXIT_FAILURE);
         }
 
       if ((err->num_warnings == 0) ||
@@ -423,8 +426,9 @@
                                   p->completed_passes+1, p->total_passes))
         {
           (void) LogMagickEvent(CoderEvent,GetMagickModule(),
-                                "Quitting due to progress monitor");
+                                "Quitting (longjmp) due to progress monitor");
           longjmp(client_data->error_recovery,1);
+          SignalHandlerExit(EXIT_FAILURE);
         }
   }
 #endif /* USE_LIBJPEG_PROGRESS */
@@ -441,7 +445,10 @@
           (void) LogMagickEvent(CoderEvent,GetMagickModule(),"%s", message);
           ThrowException2(&image->exception,CorruptImageError,(char *) message,
                           image->filename);
+          (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+                                "Longjmp error recovery");
           longjmp(client_data->error_recovery,1);
+          SignalHandlerExit(EXIT_FAILURE);
         }
     }
 }
@@ -531,7 +538,9 @@
   else
     ThrowException2(&image->exception,CoderError,(char *) message,
                     image->filename);
+  (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Longjmp error recovery");
   longjmp(client_data->error_recovery,1);
+  SignalHandlerExit(EXIT_FAILURE);
 }
 
 #define GetProfileLength(jpeg_info, length)                             \
diff -r 241c653c42ad -r a7db52b75ed2 www/Changelog.html
--- a/www/Changelog.html	Tue Jan 11 17:00:24 2022 -0600
+++ b/www/Changelog.html	Tue Jan 11 17:02:55 2022 -0600
@@ -37,9 +37,11 @@
 
 <p>2022-01-11  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/pict.c (DecodeImage): Assure that the claimed scanline
+<p>* coders/jpeg.c: Add tracing and fallback for longjmp().</p>
+<p>* coders/pict.c (DecodeImage): Assure that the claimed scanline
 length is within the bounds of the scanline allocation to avoid
-possible heap overflow.</blockquote>
+possible heap overflow.</p>
+</blockquote>
 <p>2022-01-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>
 * magick/blob.c: Make sure that read resource limiting can support
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.