TurboPack / LockBox3

LockBox3 is a Delphi and C++Builder library for cryptography.
Other
171 stars 58 forks source link

Missing compiler switches in the Alexandria version installed by GetIt #20

Closed blackshadowshade closed 2 years ago

blackshadowshade commented 2 years ago

Hi,

After installing LockBox3 via GetIt into Alexandria, I noted that my unit tests for TP LockBox3 started failing: one integer overflow error and one range checking error.

A comparison of the source code to the version we were using previously (3.6.3) shows that there are missing compiler switches for exactly these errors:

In uTPLb_SHA1.pas, there should be

{$IFOPT Q+}
  {$DEFINE OVERFLOWON}
  {$Q-}
{$ELSE}
  {$UNDEF OVERFLOWON}
{$ENDIF}
procedure TSHA1_Hasher.Update( Source: TMemoryStream);
...
end
{$IFDEF OVERFLOWON}
  {$Q+}
  {$UNDEF OVERFLOWON}
{$ENDIF}

and in uTPLb_StreamUtils.pas, there should be

{$IFOPT R+}
  {$DEFINE RANGEON}
  {$R-}
{$ELSE}
  {$UNDEF RANGEON}
{$ENDIF}
function  Stream_to_Base64( Source: TStream; const Transform: string = ''): string;
...
end
{$IFDEF RANGEON}
  {$R+}
  {$UNDEF RANGEON}
{$ENDIF}

and

{$IFOPT R+}
  {$DEFINE RANGEON}
  {$R-}
{$ELSE}
  {$UNDEF RANGEON}
{$ENDIF}
procedure CustomBase64_to_stream( const Base64: string; Destin: TStream;
  const InverseTransform: TInverseBaseTransform);
...
end
{$IFDEF RANGEON}
  {$R+}
  {$UNDEF RANGEON}
{$ENDIF}

I hope this helps someone else who stumbles across this problem, and hopefully, these changes can be reincorporated back into the packages installed by GetIt.

romankassebaum commented 2 years ago

I added your changes to the repo. Could you please check them?

blackshadowshade commented 2 years ago

Looks good to me! Closing this issue.