zeek/testing/btest/bifs/decode_base64_errors.zeek
Arne Welzel 5dc54fb40e Base64: report byte as positive integer
A baseline difference between arm64 and x86 showed up. We would
print a wrong character as negative value on x86 due to chars
being signed by default. Force an unsigned interpretation which
is also more reasonable because we'd have never indexed the
base64 table with -112

    -XXXXXXXXXX.XXXXXX      XXXXXXXXXXX     131.243.99.154  3288 193.159.183.138 80      base64_illegal_encoding character -112 ignored by Base64 decoding       F       zeek    -
    +XXXXXXXXXX.XXXXXX      XXXXXXXXXXX     131.243.99.154  3288 193.159.183.138 80      base64_illegal_encoding character 144 ignored by Base64 decoding        F       zeek    -

Fixes more of #2742
2023-02-02 15:49:22 +01:00

11 lines
253 B
Text

# @TEST-EXEC: zeek -b %INPUT >out 2>&1
# @TEST-EXEC: btest-diff out
event zeek_init()
{
local r1 = decode_base64("^#@!@##$!===");
print |r1| > 0 ? "FAIL" : "PASS";
local r2 = decode_base64("\xed\xee\xef===");
print |r2| > 0 ? "FAIL" : "PASS";
}