From: Dirk Lemstra Date: Fri, 23 Aug 2019 08:59:46 +0000 (+0200) Subject: Corrected numresolution calculation #1673. X-Git-Tag: 7.0.8-62~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=310101b45d8cddb6eceb4369fde7db59cd372865;p=imagemagick Corrected numresolution calculation #1673. --- diff --git a/ChangeLog b/ChangeLog index 3b6e5c733..2e7fb17f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ 2019-08-23 7.0.8-62 Dirk Lemstra * Added option to limit the maximum point size with -define caption:max-pointsize=pointsize. + * Corrected JP2 numresolution calculation (reference: + https://github.com/ImageMagick/ImageMagick/issues/1673) 2019-08-19 7.0.8-62 Cristy * Conditionally compile call to AcquireCLocale() (reference diff --git a/coders/jp2.c b/coders/jp2.c index 279f659cb..985db7f10 100644 --- a/coders/jp2.c +++ b/coders/jp2.c @@ -783,8 +783,7 @@ static inline int CalculateNumResolutions(size_t width,size_t height) i; for (i=1; i < 6; i++) - if ((((size_t) 1UL << (i+2)) > width) && - (((size_t) 1UL << (i+2)) > height)) + if ((width < ((size_t) 1UL << i)) || (height < ((size_t) 1UL << i))) break; return(i); }