From 9a0e811b8b3b0fda7608b0920e81cb17aad68bd2 Mon Sep 17 00:00:00 2001 From: E Spelt Date: Fri, 18 Nov 2022 23:55:54 +0100 Subject: [PATCH] fix: Overflow on Android when overflow check is off. Related to: https://github.com/Spelt/ZXing.Delphi/issues/123 --- Lib/Classes/Common/ZXing.Common.BitArrayImplementation.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/Classes/Common/ZXing.Common.BitArrayImplementation.pas b/Lib/Classes/Common/ZXing.Common.BitArrayImplementation.pas index 9413c9d..733abb9 100644 --- a/Lib/Classes/Common/ZXing.Common.BitArrayImplementation.pas +++ b/Lib/Classes/Common/ZXing.Common.BitArrayImplementation.pas @@ -158,7 +158,10 @@ function TBitArrayImplementation.getNextUnset(from: Integer): Integer; currentBits := not Fbits[bitsOffset]; // mask off lesser bits first - currentBits := currentBits and (not( (1 shl (from and $1F)) - 1)); + {$OVERFLOWCHECKS OFF} + currentBits := currentBits and -(1 shl (from and $1F)); + {$OVERFLOWCHECKS ON} + while (currentBits = 0) do begin Inc(bitsOffset);