diff options
author | David Perry <d.perry@utoronto.ca> | 2020-09-14 11:46:19 -0400 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2020-10-19 08:38:31 +0000 |
commit | c03011b906dfaad7ff25d7b6f284ee07f9aeffc1 (patch) | |
tree | 0ed45ec9a921778624b75b995f0df0c3bb3e0054 /test/lua | |
parent | 723d0fab8fb94e6a11e9b5bba86c4c6af22cf005 (diff) |
Lua: base64_decode: handle unpadded data
As noted in bug #16386, glib's `g_base64_decode_inplace()` aborts
decoding of base64 strings that aren't padded. This addresses that by
adding padding "=" characters if needed to the buffer which will be
decoded.
I added the test case from the bug report to the test suite, though the
location therein may not be ideal.
Closes #16386
Diffstat (limited to 'test/lua')
-rw-r--r-- | test/lua/tvb.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/lua/tvb.lua b/test/lua/tvb.lua index 9c9b61e56e..293c97d584 100644 --- a/test/lua/tvb.lua +++ b/test/lua/tvb.lua @@ -54,7 +54,7 @@ end -- number of verifyFields() * (1 + number of fields) + -- number of verifyResults() * (1 + 2 * number of values) -- -local taptests = { [FRAME]=4, [OTHER]=335 } +local taptests = { [FRAME]=4, [OTHER]=337 } local function getResults() print("\n-----------------------------\n") @@ -630,6 +630,12 @@ function test_proto.dissector(tvbuf,pktinfo,root) verifyResults("add_pfield-bytes", bytes_match_values) verifyFields("bytes.BYTES", bytes_match_fields) + -- extra test of ByteArray + local b64padded = ByteArray.new("dGVzdA==", true):base64_decode():raw() + local b64unpadded = ByteArray.new("dGVzdA", true):base64_decode():raw() + execute ("bytearray_base64_padded", b64padded == "test") + execute ("bytearray_base64_unpadded", b64unpadded == "test") + ---------------------------------------- testing(OTHER, "tree:add_packet_field OID") |