Skip to content

Commit 0cc39b8

Browse files
authored
Merge pull request #60 from EdwinDijkshoorn/PreventRangeCheckException
Prevent range check exception: while the original reporter still didn't provide any test data his changes to prevent this look unsuspicious so I take them now. But test data for this is still welcome!
2 parents e38e915 + 2627cfd commit 0cc39b8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

NOTICE.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ DEC - Delphi Encryption Compendium
22
Version 6.5
33

44
Copyright (c) 2018 - 2020 Norman Gallery (ng931884 [at] gmx [dot] de)
5-
Copyright (c) 2016 - 2022 Markus Humm (markus [dot] humm [at] googlemail [dot] com) (main contact)
5+
Copyright (c) 2016 - 2023 Markus Humm (markus [dot] humm [at] googlemail [dot] com) (main contact)
66
Copyright (c) 2008 - 2019 Frederik A. Winkelsdorf (winkelsdorf [at] gmail [dot] com)
77
Copyright (c) 1999 - 2008 Hagen Reddmann (HaReddmann [at] T-Online [dot] de)
88

@@ -27,6 +27,7 @@ Gloegg
2727
pierangelodalben
2828
denovosoftware
2929
alexrayne
30+
Stevie
3031

3132
Parts of the work loosely based on the works of Wolfgang Erhardt, who is
3233
unfortunately dead already.

Source/DECCipherModesGCM.pas

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,8 @@ procedure TGCM.DecodeGCM(Source, Dest: TBytes; Size: Integer);
608608
a_tag := XOR_T128(CalcGaloisHash(DataToAuthenticate, Source, Size), FE_K_Y0);
609609

610610
Setlength(FCalcAuthenticationTag, FCalcAuthenticationTagLength);
611-
Move(a_tag[0], FCalcAuthenticationTag[0], FCalcAuthenticationTagLength);
611+
if (FCalcAuthenticationTagLength > 0) then
612+
Move(a_tag[0], FCalcAuthenticationTag[0], FCalcAuthenticationTagLength);
612613

613614
// Check for correct authentication result is in Done of DECCipherModes
614615
// if not IsEqual(FExpectedAuthenticationTag, FCalcAuthenticationTag) then
@@ -646,7 +647,8 @@ procedure TGCM.EncodeGCM(Source, Dest: TBytes; Size: Integer);
646647

647648
AuthTag := XOR_T128(CalcGaloisHash(DataToAuthenticate, Dest, Size), FE_K_Y0);
648649
Setlength(FCalcAuthenticationTag, FCalcAuthenticationTagLength);
649-
Move(AuthTag[0], FCalcAuthenticationTag[0], FCalcAuthenticationTagLength);
650+
if (FCalcAuthenticationTagLength > 0) then
651+
Move(AuthTag[0], FCalcAuthenticationTag[0], FCalcAuthenticationTagLength);
650652
end;
651653

652654
function TGCM.EncodeT128(Value: T128): T128;

0 commit comments

Comments
 (0)