mirror of
https://github.com/znc/znc.git
synced 2026-06-11 17:25:04 +02:00
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:
+3
-1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user