From 3bea9f61e61ed3307b2471634afcfc9b80fd3706 Mon Sep 17 00:00:00 2001 From: David Brown Date: Fri, 16 Oct 2020 13:15:59 -0600 Subject: [PATCH] Add a context-info.sh test for 0xFF chars Add a non-regression test for ssl_context_info to ensure the base64 decoder doesn't stop processing when it encounters a 0xFF character. Signed-off-by: David Brown --- tests/context-info.sh | 5 +++++ tests/data_files/base64/def_b64_ff.bin | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 tests/data_files/base64/def_b64_ff.bin diff --git a/tests/context-info.sh b/tests/context-info.sh index 150584b5d..68614ff40 100755 --- a/tests/context-info.sh +++ b/tests/context-info.sh @@ -430,6 +430,11 @@ run_test "Binary file instead of text file" \ -u "Too many bad symbols detected. File check aborted" \ -n "Deserializing" +run_test "Decoder continues past 0xff character" \ + "def_b64_ff.bin" \ + -n "No valid base64" \ + -u "ciphersuite.* TLS-" + # End of tests diff --git a/tests/data_files/base64/def_b64_ff.bin b/tests/data_files/base64/def_b64_ff.bin new file mode 100644 index 000000000..66aa8271c --- /dev/null +++ b/tests/data_files/base64/def_b64_ff.bin @@ -0,0 +1,5 @@ +// Ensure that the b64 parser continues after encountering a 0xFF +// character. Note that this byte is invalid UTF-8, making this +// entire file invalid UTF-8. Use care when editing. +// -> ÿ <- +AhUAAH8AAA4AAABtAAAAAF6HQx3MqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACG2QbHbUj8eGpdx5KVIebiwk0jvRj9/3m6BOSzpA7qBXeEunhqr3D11NE7ciGjeHMAAACAAAAAAAAAAAAAAAAAAV6HQx248L77RH0Z973tSYNQ8zBsz861CZG5/T09TJz3XodDHe/iJ+cgXb5An3zTdnTBtw3EWAb68T+gCE33GN8AAAAAAAAAAAAAAAEAAAAAAAAAAwAAAQAAAAAAAgAAAA==