Changeset

12716:0b68b021ce46

util.paseto: Do strict type check in pae() function Fixes a test failure on Lua 5.4 where ipairs("") does not produce an error.
author Kim Alvefur <zash@zash.se>
date Mon, 11 Jul 2022 18:48:57 +0200
parents 12715:5dd00f806e32
children 12717:898e99f49d80
files util/paseto.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/paseto.lua	Mon Jul 11 17:11:38 2022 +0200
+++ b/util/paseto.lua	Mon Jul 11 18:48:57 2022 +0200
@@ -23,6 +23,9 @@
 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);