Skip to content

Commit

Permalink
6baee9ef9d5657ab582c8a4b9f885ec58ed502d0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan authored and well-in-that-case committed Sep 22, 2023
1 parent 4c0d4be commit 35a74ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/lundump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static size_t loadUnsigned (LoadState *S, size_t limit) {


static size_t loadSize (LoadState *S) {
return loadUnsigned(S, ~(size_t)0);
return loadUnsigned(S, MAX_SIZET);
}


Expand Down
14 changes: 0 additions & 14 deletions testes/calls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -343,20 +343,6 @@ do -- another bug (in 5.4.0)
end


if not _port then -- another bug (since 5.2)
-- corrupted binary dump: list of upvalue names is larger than number
-- of upvalues, overflowing the array of upvalues.
local code =
"\x1b\x4c\x75\x61\x54\x00\x19\x93\x0d\x0a\x1a\x0a\x04\x08\x08\x78\x56\z
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x28\x77\x40\x00\x86\x40\z
\x74\x65\x6d\x70\x81\x81\x01\x00\x02\x82\x48\x00\x02\x00\xc7\x00\x01\z
\x00\x80\x80\x80\x82\x00\x00\x80\x81\x82\x78\x80\x82\x81\x86\x40\x74\z
\x65\x6d\x70"

assert(load(code)) -- segfaults in previous versions
end


x = string.dump(load("x = 1; return x"))
a = assert(load(read1(x), nil, "b"))
assert(a() == 1 and _G.x == 1)
Expand Down
11 changes: 11 additions & 0 deletions testes/pluto/basic.pluto
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,17 @@ do
(function (x) a=x end)("hello")
assert(a == "hello")
end
do
-- corrupted binary dump: list of upvalue names is larger than number of upvalues, overflowing the array of upvalues.
-- this mustn't segfault
local code =
"\x1b\x4c\x75\x61\x54\x00\x19\x93\x0d\x0a\x1a\x0a\x04\x08\x08\x78\x56\z
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x28\x77\x40\x00\x86\x40\z
\x74\x65\x6d\x70\x81\x81\x01\x00\x02\x82\x48\x00\x02\x00\xc7\x00\x01\z
\x00\x80\x80\x80\x82\x00\x00\x80\x81\x82\x78\x80\x82\x81\x86\x40\x74\z
\x65\x6d\x70"
assert(load(code))
end

print "Testing universal functions."
do
Expand Down

0 comments on commit 35a74ed

Please sign in to comment.