From a3e182ffa1718472d8bae11b27004f6c6311b4a3 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 11 Jul 2022 18:48:57 +0200 Subject: util.paseto: Do strict type check in pae() function Fixes a test failure on Lua 5.4 where ipairs("") does not produce an error. --- util/paseto.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/paseto.lua b/util/paseto.lua index a39f9667..8b564c96 100644 --- a/util/paseto.lua +++ b/util/paseto.lua @@ -23,6 +23,9 @@ local function le64(n) end local function pae(parts) + if type(parts) ~= "table" then + error("bad argument #1 to 'pae' (table expected, got "..type(parts)..")"); + end local o = { le64(#parts) }; for _, part in ipairs(parts) do table.insert(o, le64(#part)..part); -- cgit v1.2.3