Correction of maximum string size in 'lundump'

The maximum size for internal strings in Lua is MAX_SIZE minus
'sizeof(TString)'. Moreover, 'loadVarint' must be precise about the
limit of the integer being read.
This commit is contained in:
Roberto I
2026-10-07 16:02:48 -03:00
parent 0b29f40843
commit 745b96db54
3 changed files with 17 additions and 13 deletions
+6
View File
@@ -385,6 +385,12 @@ do
assert(minint == load("return " .. minint)())
assert(eqT(maxint, load("return " .. maxint)()))
-- limit for integer encoding in binary chunks
-- (~(-1 >> 1) is optimized by the compiler as minint, which is
-- then encoded in a binary chunk as max unsigned)
local f = string.dump(function () return ~(-1 >> 1) end)
assert(load(f)() == minint)
assert(eqT(10000000000000000000000.0, 10000000000000000000000))
assert(eqT(-10000000000000000000000.0, -10000000000000000000000))
end