minetest.deserialize: Throw error when argument not string (#5738)
authorSmallJoker <SmallJoker@users.noreply.github.com>
Tue, 9 May 2017 21:11:20 +0000 (23:11 +0200)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Tue, 9 May 2017 21:11:20 +0000 (23:11 +0200)
builtin/common/serialize.lua

index b2165648ed472255ee281bdaccd851420a1df56c..692ddd5f0f132c37bca0967f947ea87f9e56a64e 100644 (file)
@@ -186,6 +186,10 @@ local safe_env = {
 }
 
 function core.deserialize(str, safe)
+       if type(str) ~= "string" then
+               return nil, "Cannot deserialize type '"..type(str)
+                       .."'. Argument must be a string."
+       end
        if str:byte(1) == 0x1B then
                return nil, "Bytecode prohibited"
        end