GraphicsMagick: WriteJPEGImage(): Do not set image resolution if...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.4600.1680996701.1830.graphicsmagick-commit@lists.sourceforge.net>
changeset 8bec800dbaef in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=8bec800dbaef
summary: WriteJPEGImage(): Do not set image resolution if the values provided are outside of the valid range.

diffstat:

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

diffs (39 lines):

diff -r f00ee8bb732b -r 8bec800dbaef ChangeLog
--- a/ChangeLog	Sat Apr 08 18:04:16 2023 -0500
+++ b/ChangeLog	Sat Apr 08 18:31:31 2023 -0500
@@ -1,5 +1,9 @@
 2023-04-08  Bob Friesenhahn  <[email protected]>
 
+	* coders/jpeg.c (WriteJPEGImage): Do not set image resolution if
+	the values provided are outside of the valid range (SourceForge
+	issue #706 test case 'bug4').
+
 	* coders/rle.c (ReadRLEImage): Eliminate a unsigned offset
 	overflow runtime error from UBSAN (SourceForge issue #706 test
 	case 'bug5').
diff -r f00ee8bb732b -r 8bec800dbaef coders/jpeg.c
--- a/coders/jpeg.c	Sat Apr 08 18:04:16 2023 -0500
+++ b/coders/jpeg.c	Sat Apr 08 18:31:31 2023 -0500
@@ -2790,7 +2790,8 @@
     (void) LogMagickEvent(CoderEvent,GetMagickModule(),
       "Image resolution: %ld,%ld",(long) image->x_resolution,
       (long) image->y_resolution);
-  if ((image->x_resolution != 0) && (image->y_resolution != 0))
+  if ((image->x_resolution >= 0) && (image->x_resolution < (double) SHRT_MAX) &&
+      (image->y_resolution >= 0) && (image->y_resolution < (double) SHRT_MAX))
     {
       /*
         Set image resolution.
diff -r f00ee8bb732b -r 8bec800dbaef www/Changelog.html
--- a/www/Changelog.html	Sat Apr 08 18:04:16 2023 -0500
+++ b/www/Changelog.html	Sat Apr 08 18:31:31 2023 -0500
@@ -40,6 +40,9 @@
 <p>2023-04-08  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>
 <ul class="simple">
+<li><p>coders/jpeg.c (WriteJPEGImage): Do not set image resolution if
+the values provided are outside of the valid range (SourceForge
+issue #706 test case 'bug4').</p></li>
 <li><p>coders/rle.c (ReadRLEImage): Eliminate a unsigned offset
 overflow runtime error from UBSAN (SourceForge issue #706 test
 case 'bug5').</p></li>
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.