diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-25 09:46:47 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-25 09:46:47 +0100 |
commit | 0295d3ba5d02bf65370db6bdd197bdd8f50a0f91 (patch) | |
tree | 1abcfa4bec6512192f4882a2bf7263366335c60a /test/lua/unit/quoted_printable.lua | |
parent | e4dbb877a320ad27592fb3cbfec0f45085c01012 (diff) | |
download | rspamd-0295d3ba5d02bf65370db6bdd197bdd8f50a0f91.tar.gz rspamd-0295d3ba5d02bf65370db6bdd197bdd8f50a0f91.zip |
[Fix] Fix out-of-bound read in qp decode
Diffstat (limited to 'test/lua/unit/quoted_printable.lua')
-rw-r--r-- | test/lua/unit/quoted_printable.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/lua/unit/quoted_printable.lua b/test/lua/unit/quoted_printable.lua index 50d357ea0..cf667f8d4 100644 --- a/test/lua/unit/quoted_printable.lua +++ b/test/lua/unit/quoted_printable.lua @@ -95,6 +95,24 @@ context("Quoted-Printable encoding", function() assert_rspamd_eq(res) end) end + -- Decode issues + cases = { + { + 'Mailscape External Mail Flow Outbound Test=', + 'Mailscape External Mail Flow Outbound Test=', + 'asan found' + }, + } + + for _,c in ipairs(cases) do + test("QP decoding test case: " .. c[3], function() + local res = { + expect = c[2], + actual = tostring(rspamd_util.decode_qp(c[1])) + } + assert_rspamd_eq(res) + end) + end -- Fuzz testing local charset = {} @@ -109,7 +127,6 @@ context("Quoted-Printable encoding", function() end end - for _,l in ipairs({10, 100, 1000, 10000}) do test("QP fuzz test max length " .. tostring(l), function() for _=1,100 do |