We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, there is a range check error in the ZXing.Common.BitMatrix.pas. the integer var must be Int64, because the function TMathUtils.Asr return int64.
//original function TBitMatrix.getBit(x, y: Integer): Boolean; var offset, v, bits, shift: Integer; uBits: Cardinal; begin offset := y * FrowSize + TMathUtils.Asr(x, 5); try bits := Fbits[offset]; uBits := Cardinal(bits); shift := (x and $1F); v := TMathUtils.Asr(uBits, shift); Result := (v and 1) <> 0; except Result := false; end; end;
//fixed function TBitMatrix.getBit(x, y: Integer): Boolean; var offset, v, bits, shift: Int64; uBits: Cardinal; begin offset := y * FrowSize + TMathUtils.Asr(x, 5); try bits := Fbits[offset]; uBits := Cardinal(bits); shift := (x and $1F); v := TMathUtils.Asr(uBits, shift); Result := (v and 1) <> 0; except Result := false; end; end;
The text was updated successfully, but these errors were encountered:
Thanks! It will be fixed in the next version. Will be released today.
Sorry, something went wrong.
fix: ZXing.Common.BitMatrix Range Check Error - #104
a2ad2bb
No branches or pull requests
Hi,
there is a range check error in the ZXing.Common.BitMatrix.pas.
the integer var must be Int64, because the function TMathUtils.Asr return int64.
//original
function TBitMatrix.getBit(x, y: Integer): Boolean;
var
offset, v, bits, shift: Integer;
uBits: Cardinal;
begin
offset := y * FrowSize + TMathUtils.Asr(x, 5);
try
bits := Fbits[offset];
uBits := Cardinal(bits);
shift := (x and $1F);
v := TMathUtils.Asr(uBits, shift);
Result := (v and 1) <> 0;
except
Result := false;
end;
end;
//fixed
function TBitMatrix.getBit(x, y: Integer): Boolean;
var
offset, v, bits, shift: Int64;
uBits: Cardinal;
begin
offset := y * FrowSize + TMathUtils.Asr(x, 5);
try
bits := Fbits[offset];
uBits := Cardinal(bits);
shift := (x and $1F);
v := TMathUtils.Asr(uBits, shift);
Result := (v and 1) <> 0;
except
Result := false;
end;
end;
The text was updated successfully, but these errors were encountered: