From 310101b45d8cddb6eceb4369fde7db59cd372865 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Fri, 23 Aug 2019 10:59:46 +0200 Subject: [PATCH] Corrected numresolution calculation #1673. --- ChangeLog | 2 ++ coders/jp2.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) 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); } -- 2.40.0