Commit 5ea763230 for imagemagick.org

commit 5ea763230a80d2ef1c8323d6b2645dddc1f2f7ca
Author: tomotomo <tomoppeko@gmail.com>
Date:   Mon Nov 9 21:45:45 2026 +0900

    Never decode a JPEG smaller than the jpeg:size hint (#9110)

diff --git a/coders/jpeg.c b/coders/jpeg.c
index 177166e37..f9b8dade2 100644
--- a/coders/jpeg.c
+++ b/coders/jpeg.c
@@ -1736,7 +1736,12 @@ static Image *ReadOneJPEGImage(const ImageInfo *image_info,
           (scale_factor > (jpeg_info->output_height/geometry_info.sigma)))
         scale_factor=jpeg_info->output_height/geometry_info.sigma;
 #if defined(LIBJPEG_TURBO_VERSION_NUMBER) || (JPEG_LIB_VERSION >= 70)
-      jpeg_info->scale_num=(unsigned int) (8.0/scale_factor+0.5);
+      /*
+        Use the smallest scaling factor (M/8) that is not smaller than the
+        size hint.
+      */
+      jpeg_info->scale_num=(unsigned int) ceil(MagickMin(8.0/scale_factor,
+        16.0)-MagickEpsilon);
       if (jpeg_info->scale_num > 16U)
         jpeg_info->scale_num=16U;
       if (jpeg_info->scale_num < 1U)