]> git.lizzy.rs Git - worldedit.git/commitdiff
Call minetest.deserialize with safe=true
authorsfan5 <sfan5@live.de>
Thu, 6 Feb 2020 10:53:14 +0000 (11:53 +0100)
committersfan5 <sfan5@live.de>
Thu, 6 Feb 2020 10:53:14 +0000 (11:53 +0100)
wtf?

worldedit/serialization.lua

index b1faca894270302a313f83886f753a6ecd9ec635..c3793b2475509f934fe42d2360b1e84f8b0bd7a9 100644 (file)
@@ -119,7 +119,7 @@ end
 local function deserialize_workaround(content)\r
        local nodes\r
        if not jit then\r
-               nodes = minetest.deserialize(content)\r
+               nodes = minetest.deserialize(content, true)\r
        else\r
                -- XXX: This is a filthy hack that works surprisingly well\r
                -- in LuaJIT, `minetest.deserialize` will fail due to the register limit\r
@@ -135,11 +135,11 @@ local function deserialize_workaround(content)
                                break\r
                        end\r
                        local current = content:sub(startpos1, startpos)\r
-                       local entry = minetest.deserialize("return " .. current)\r
+                       local entry = minetest.deserialize("return " .. current, true)\r
                        table.insert(nodes, entry)\r
                        startpos, startpos1 = endpos, endpos\r
                end\r
-               local entry = minetest.deserialize("return " .. content:sub(startpos1)) -- process the last entry\r
+               local entry = minetest.deserialize("return " .. content:sub(startpos1), true) -- process the last entry\r
                table.insert(nodes, entry)\r
        end\r
        return nodes\r
@@ -151,7 +151,7 @@ local function load_schematic(value)
        local version, header, content = worldedit.read_header(value)\r
        local nodes = {}\r
        if version == 1 or version == 2 then -- Original flat table format\r
-               local tables = minetest.deserialize(content)\r
+               local tables = minetest.deserialize(content, true)\r
                if not tables then return nil end\r
 \r
                -- Transform the node table into an array of nodes\r