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 <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></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>