From 4b8099808ee1060954e7670368a9d52bad609294 Mon Sep 17 00:00:00 2001 From: Dustin Specker Date: Thu, 2 Jan 2025 16:41:26 -0600 Subject: [PATCH] fix(lib/events/filesessions): replace int64 conversion with comparison This prevents any unsafe int64 to int conversions. --- lib/events/filesessions/fileasync_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/events/filesessions/fileasync_test.go b/lib/events/filesessions/fileasync_test.go index 06e3b74965789..2815e5bf34500 100644 --- a/lib/events/filesessions/fileasync_test.go +++ b/lib/events/filesessions/fileasync_test.go @@ -682,7 +682,11 @@ func readStream(ctx context.Context, t *testing.T, uploadID string, uploader *ev // sort audit events by index slices.SortStableFunc(outEvents, func(a apievents.AuditEvent, b apievents.AuditEvent) int { - return int(a.GetIndex() - b.GetIndex()) + if a.GetIndex() < b.GetIndex() { + return -1 + } + + return 1 }) // remove any audit events with duplicate indexes