diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-07-16 23:50:13 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-07-16 23:58:43 +0100 |
commit | 93022e6207ed15f8dd231ad43511d7c9e3f2eee8 (patch) | |
tree | dc8f3ccf1b98313a916f9f015b8958627bd88624 | |
parent | f8f9f3637976beb2368572d56994235fd39bf55c (diff) | |
download | rspamd-93022e6207ed15f8dd231ad43511d7c9e3f2eee8.tar.gz rspamd-93022e6207ed15f8dd231ad43511d7c9e3f2eee8.zip |
[Test] Check the decoded length when doing base32 fuzz test
-rw-r--r-- | test/lua/unit/base32.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/lua/unit/base32.lua b/test/lua/unit/base32.lua index a460b6575..d6e67c06a 100644 --- a/test/lua/unit/base32.lua +++ b/test/lua/unit/base32.lua @@ -33,7 +33,7 @@ context("Base32 encodning", function() end end) - test("Base32 fuzz test", function() + test("Base32 fuzz test: zbase32", function() for i = 1,1000 do local b, l = random_buf(4096) local how = math.floor(math.random(3) - 1) @@ -42,6 +42,8 @@ context("Base32 encodning", function() local nl = ffi.new("size_t [1]") local nb = ffi.C.rspamd_decode_base32(bs, #bs, nl, how) + assert_equal(tonumber(nl[0]), l, + string.format("invalid size reported: %d reported vs %d expected", tonumber(nl[0]), l)) local cmp = ffi.C.memcmp(b, nb, l) ffi.C.g_free(ben) ffi.C.g_free(nb) |