From 7f4c07d886404eb2f5239f01c817d8fd0187175e Mon Sep 17 00:00:00 2001 From: Damiano Donati Date: Mon, 1 Dec 2025 15:03:21 +0100 Subject: [PATCH] fix: e2e: validate inputData during log postprocessing to avoid panic --- test/e2e/shared/common.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/e2e/shared/common.go b/test/e2e/shared/common.go index 38553e3f5c..5c95a9f348 100644 --- a/test/e2e/shared/common.go +++ b/test/e2e/shared/common.go @@ -312,7 +312,11 @@ func postProcessBase64LogData(dir, src, dst string) error { } // Extract second line which contains the data (first line contains the command) - inputStringData := strings.Split(string(inputData), "\n")[1] + inputDataLines := strings.Split(string(inputData), "\n") + if len(inputDataLines) < 2 { + return errors.Errorf("source file %q does not contain expected data (need at least 2 lines, got %d), input data content: %q", sourceFile, len(inputDataLines), string(inputData)) + } + inputStringData := inputDataLines[1] // Trim spaces and the $ suffix. inputStringData = strings.TrimSpace(inputStringData)