From: Vsevolod Stakhov Date: Sat, 16 Jul 2022 22:50:13 +0000 (+0100) Subject: [Test] Check the decoded length when doing base32 fuzz test X-Git-Tag: 3.3~128 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=93022e6207ed15f8dd231ad43511d7c9e3f2eee8;p=rspamd.git [Test] Check the decoded length when doing base32 fuzz test --- 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)