Browse Source

decrease restarts_to_go only if restart is enabled (solves runtime error if compiled with range checks)

Ondrej Pokorny 4 months ago
parent
commit
ec5b4d458e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      packages/pasjpeg/src/jdhuff.pas

+ 2 - 1
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;