From 099895b1f06fa69940f9cea30ba36e4f2a9c526b Mon Sep 17 00:00:00 2001 From: MarkLee131 Date: Wed, 29 Apr 2026 19:33:30 +0800 Subject: [PATCH] test: fix \xff hex escape parsing in Base64 test for stricter compilers GCC parses "AA\xffA" greedily as \xffA (next character is a hex digit), which is out of range for char and breaks the Linux CI build. Split the literal into "AA\xff" "A" so the escape resolves before the next string, yielding the intended four bytes (A, A, 0xff, A). --- test/StringTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/StringTest.cpp b/test/StringTest.cpp index d1127454..4bde1b4c 100644 --- a/test/StringTest.cpp +++ b/test/StringTest.cpp @@ -204,7 +204,9 @@ TEST(StringTest, Base64) { sInvalid.Base64Decode(sOut); // must not crash or trigger UB // Mixed-validity input (a single non-alphabet byte inside a quad). - CString sMixed = CString("AA\xffA", 4); + // Split the literal so GCC does not parse \xff and the following A as + // a single \xffA hex escape (out of range for char). + CString sMixed = CString("AA\xff" "A", 4); sMixed.Base64Decode(sOut); // must not crash or trigger UB }