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).
This commit is contained in:
MarkLee131
2026-04-29 19:33:30 +08:00
parent d60f489c27
commit 099895b1f0
+3 -1
View File
@@ -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
}