lua-users home
lua-l archive

Bug: loadstring() code validator sometimes incorrectly flags chunks as bad

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


If you have a table constructor of the right size, the integer stored
in the opcode slot following a SETLIST (C=0) can look like another
SETLIST (C=0). The code checker will complain about legitimate jumps
to the instruction immediately following this integer.
Example:
> z={}
> for i=1,27290 do z[i]='1,' end
> z = 'if 1+1==2 then local a={' .. table.concat(z) .. '} end'
> func = loadstring(z)
> =func
function: 0x3092c0
> =loadstring(string.dump(func))
nil binary string: bad code in precompiled chunk
Greg F

AltStyle によって変換されたページ (->オリジナル) /