From ec5b4d458eb30432becb64bd3c0dcd8a9aebd055 Mon Sep 17 00:00:00 2001 From: Ondrej Pokorny Date: Fri, 28 Mar 2025 10:18:39 +0100 Subject: [PATCH] decrease restarts_to_go only if restart is enabled (solves runtime error if compiled with range checks) --- packages/pasjpeg/src/jdhuff.pas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/pasjpeg/src/jdhuff.pas b/packages/pasjpeg/src/jdhuff.pas index 07541ad420..952446e32d 100644 --- a/packages/pasjpeg/src/jdhuff.pas +++ b/packages/pasjpeg/src/jdhuff.pas @@ -1240,7 +1240,8 @@ begin end; { Account for restart interval (no-op if not using restarts) } - Dec(entropy^.restarts_to_go); + if (cinfo^.restart_interval <> 0) then + Dec(entropy^.restarts_to_go); decode_mcu := TRUE; end;