From 0d811ce8b0de3892223622793ea83c686de662fc Mon Sep 17 00:00:00 2001 From: DougManton Date: Thu, 14 Mar 2024 15:51:02 +0000 Subject: [PATCH] [pkg/ottl] #31543 Add additional negative unit tests for Base64Decode --- pkg/ottl/ottlfuncs/func_base64decode_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/ottl/ottlfuncs/func_base64decode_test.go b/pkg/ottl/ottlfuncs/func_base64decode_test.go index 41cd661c9c96..e6abf925fd98 100644 --- a/pkg/ottl/ottlfuncs/func_base64decode_test.go +++ b/pkg/ottl/ottlfuncs/func_base64decode_test.go @@ -66,6 +66,16 @@ func Test_Base64DecodeError(t *testing.T) { value: nil, expectedError: "expected string but got nil", }, + { + name: "not-base64-string", + value: "!@#$%^&*()_+", + expectedError: "illegal base64 data at input byte", + }, + { + name: "missing-base64-padding", + value: "cmVtb3ZlZCBwYWRkaW5nCg", + expectedError: "illegal base64 data at input byte", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {