Skip to content

Commit

Permalink
Refactor test setup, fix UDK CI builds, fix UDK array OOB warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tuokri committed Jul 4, 2024
1 parent 2acc8c2 commit af8c7d0
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/udk-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
# TODO: unify GH env vars with local UDKTests env vars somehow.
env:
UDK_LITE_CACHE: ${{ github.workspace }}/UDKTests/.cache/
UDK_LITE_TAG: 1.0.1
UDK_LITE_TAG: 1.0.2
# Timeout for individual steps in the test script. Not a total timeout.
UDK_TEST_TIMEOUT: 300
PYTHONUNBUFFERED: 1
Expand Down
17 changes: 16 additions & 1 deletion Classes/FCryptoBigInt.uc
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ static final function MemMove(
local int Mask;
local array<byte> DstBytes;
local int DstTmp;
local int MaxIntIndex;

DstBytes.Length = NumBytes;

Expand All @@ -291,10 +292,18 @@ static final function MemMove(
Shift = 8;
Mask = 0xff << Shift;
IntIndex = DstOffset;

MaxIntIndex = FFloor(DstOffset + (NumBytes / 2));
if (MaxIntIndex >= Dst.Length)
{
Dst.Length = MaxIntIndex + 1;
}

for (ByteIndex = 0; ByteIndex < NumBytes; ++ByteIndex)
{
`fcsdebug("IntIndex=" $ IntIndex);
// `fcsdebug("IntIndex=" $ IntIndex);

// TODO: is DstTmp needed? (Also check other memory functions).
DstTmp = (Dst[IntIndex] & ~Mask) | ((DstBytes[ByteIndex] & 0xff) << Shift);
Dst[IntIndex] = DstTmp;

Expand Down Expand Up @@ -555,6 +564,12 @@ static final function int Sub(

Cc = 0;
M = (A[0] + 31) >>> 4;

if (M > A.Length)
{
A.Length = M;
}

for (U = 1; U < M; ++U)
{
Aw = A[U];
Expand Down
14 changes: 11 additions & 3 deletions Classes/FCryptoGMPClient.uc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ var private array<string> Responses;
var private int TransactionID;
var private array<string> TransactionStack;

var bool bTestMutatorDone;
var bool bDone;

struct PendingCheck
{
var string TestName;
Expand Down Expand Up @@ -90,6 +92,11 @@ simulated event Tick(float DeltaTime)
local int Temp;
local bool bSuccess;

if (bDone && bTestMutatorDone)
{
return;
}

for (I = 0; I < Responses.Length; ++I)
{
if (Responses[I] == "SERVER_ERROR")
Expand Down Expand Up @@ -188,8 +195,8 @@ simulated event Tick(float DeltaTime)
if (ChecksDone > 0 && (ChecksDone >= RequiredChecks))
{
`fclog("--- ALL CHECKS DONE" @ ChecksDone $ "/" $ RequiredChecks @ "---");
ChecksDone = 0;
RequiredChecks = 0;
// ChecksDone = 0;
// RequiredChecks = 0;
if (Failures > 0)
{
Expand Down Expand Up @@ -253,7 +260,8 @@ final simulated function Eq(string GMPOperandName, const out array<int> B,
Check.BigIntOperand = B;
PendingChecks.AddItem(Check);
RequiredChecks = PendingChecks.Length;
// RequiredChecks = PendingChecks.Length;
++RequiredChecks;
}
final simulated function RandPrime(int Size)
Expand Down
Loading

0 comments on commit af8c7d0

Please sign in to comment.