Roberto Ierusalimschy
6d042a178f
Auxiliary buffer uses external strings
The buffer system from the auxiliary library reuses its buffer
as external memory when closing long strings.
12 months ago
Roberto Ierusalimschy
3b57e37e48
Fixed buffers save long strings as external.
1 year ago
Roberto Ierusalimschy
024f9064f1
External strings
Strings can use external buffers to store their contents.
1 year ago
Roberto Ierusalimschy
7923dbbf72
Bug: Recursion in 'getobjname' can stack overflow
'getobjname' now broken in two, a basic version that handles locals,
upvalues, and constants, and a full version, which uses the basic
version to handle table accesses (globals and fields).
1 year ago
Roberto Ierusalimschy
6baee9ef9d
Removed test for "corrupted binary dump"
Test is too non portable. (For instance, it does not work for
different number types.)
1 year ago
Roberto Ierusalimschy
14e416355f
Added suport for Fixed Buffers
A fixed buffer keeps a binary chunk "forever", so that the program
does not need to copy some of its parts when loading it.
1 year ago
Roberto Ierusalimschy
5ab6a5756b
Bug: Wrong line number for function calls
1 year ago
Roberto Ierusalimschy
f4211a5ea4
More control over encoding of test files
The few UTF-8 test files are commented as such, and there is only one
non UTF-8 test file (to test non UTF-8 sources).
1 year ago
Roberto Ierusalimschy
cbae016202
Details
1 year ago
Roberto Ierusalimschy
09f3c2372f
Option '-l' discards version sufix from file name
Like 'require', the command-line option '-l' discards an optional
version suffix (everything after an hyphen) from a file name when
creating the module name.
2 years ago
Roberto Ierusalimschy
c197885cb0
Small improvements in tests
2 years ago
Roberto Ierusalimschy
ab859fe59b
Bug: Loading a corrupted binary file can segfault
The size of the list of upvalue names are stored separated from the
size of the list of upvalues, but they share the same array.
2 years ago
Roberto Ierusalimschy
02bab9fc25
Bug: Wrong line in error message for arith. errors
It also causes 'L->top' to be wrong when the error happens,
triggering an 'assert'.
2 years ago
Roberto Ierusalimschy
314745ed84
Avoid excessive name pollution in test files
Test files are more polite regarding the use of globals when locals
would do, and when globals are necessary deleting them after use.
2 years ago
Roberto Ierusalimschy
0825cf237d
Detail in make file for testes/libs
Everything depends on the Lua version (as given by 'lua.h')
2 years ago
Roberto Ierusalimschy
7d4c7ae2af
Changes in opcodes for generic 'for'
Again, as the control variable is read only, the code doesn't need
to keep an internal copy of it.
2 years ago
Roberto Ierusalimschy
b2f7b3b79f
Control variables in for loops are read only
2 years ago
Roberto Ierusalimschy
540d805226
Towards Lua 5.5
2 years ago
Roberto Ierusalimschy
7d6a97e42b
Dump doesn't need to reuse 'source'
All strings are being reused now, including 'source'.
2 years ago
Roberto Ierusalimschy
d738c8d18b
New function 'luaL_openselectedlibs'
Makes it easier to start Lua with only some standard libraries.
2 years ago
Roberto Ierusalimschy
8047b2d03e
Tables have a 'lastfree' information only when needed
Only tables with some minimum number of entries in their hash part
have a 'lastfree' field, kept in a header before the node vector.
2 years ago
Roberto Ierusalimschy
1e64c1391f
Bug: stack overflow with nesting of coroutine.close
2 years ago
Roberto Ierusalimschy
7f12bf40c4
Portability issue in a test for 'string.format'
2 years ago
Roberto Ierusalimschy
26be27459b
Negation in constant folding of '>>' may overflow
2 years ago
Roberto Ierusalimschy
cfbe378f90
Small simplification in overflow check in 'getfield'
Subtracting a small non-negative int from a non-negative int cannot
overflow, and adding a non-negative int to INT_MIN cannot overflow.
2 years ago
Roberto Ierusalimschy
a1089b415a
Bug: 'utf8.codes' accepts spurious continuation bytes
2 years ago
Roberto Ierusalimschy
f8c4c4fcf2
New test for table rehash
2 years ago
Roberto Ierusalimschy
997f11f543
Bug: 'break' may not properly close variable in a 'for' loop
Function 'leaveblock' was generating "break" label before removing
variables from the closing block. If 'createlabel' created a 'close'
instruction (which it did when matching a goto/break that exited
the scope of an upvalue), that instruction would use the wrong level.
2 years ago
Roberto Ierusalimschy
02060b7a37
Simpler handling of Byte Order Mark (BOM)
2 years ago
Roberto Ierusalimschy
d61b0c6028
More checks and documentation for uses of EXTRA_STACK
2 years ago
Roberto Ierusalimschy
196bb94d66
Bug: 'lua_settop' may use an invalid pointer to stack
2 years ago
Roberto Ierusalimschy
4a00f61276
'lua_checkstack' doesn't need to check stack overflow
'luaD_growstack' already checks that. This commit also fixes an
internal bug in 'luaD_growstack': a large 'n' could cause an arithmetic
overflow when computing 'needed'.
2 years ago
Roberto Ierusalimschy
c764ca71a6
Bug: Wrong code generation in bitwise operations
3 years ago
Roberto Ierusalimschy
1f3c6f4534
Bug: Lua can generate wrong code when _ENV is <const>
3 years ago
Roberto Ierusalimschy
597a53bbc6
Bug: finalizer calling exit can corrupt finalization order
'os.exit' can call lua_close again, separating new finalizers
created after all previous finalizers were already separated.
3 years ago
Roberto Ierusalimschy
066e0f93c4
Fix debug information about finalizers
The flag CIST_FIN does not mark a finalizer, but the function that was
running when the finalizer was called. (So, the function did not call
the finalizer, but it looks that way in the stack.)
3 years ago
Roberto Ierusalimschy
0bfc572e51
Bug: GC is not reentrant
As the GC is not reentrant, finalizers should not be able to invoke it.
3 years ago
Roberto Ierusalimschy
48835c76c8
Wrong assert in 'collectvalidlines'
3 years ago
Roberto Ierusalimschy
e8deac5a41
Avoid OP_VARARGPREP for active lines
when building the table 'activelines' for a vararg function, this
first instruction does not make the first line active.
3 years ago
Roberto Ierusalimschy
bfbff3703e
Bug: Wrong status in coroutine during reset
When closing variables during 'coroutine.close' or 'lua_resetthread',
the status of a coroutine must be set to LUA_OK; a coroutine should
not run with any other status. (See assertion in 'lua_callk'.)
After the reset, the status should be kept as normal, as any error
was already reported.
3 years ago
Roberto Ierusalimschy
74d99057a5
Bug: C stack overflow with coroutines
'coroutine.resume' did not increment counter of C calls when
continuing execution after a protected error (that is,
while running 'precover').
3 years ago
Roberto Ierusalimschy
deac067ed3
Avoid overflows when incrementing parameters in C
Any C function can receive maxinteger as an integer argument, and
therefore cannot increment it without some care (e.g., doing unsigned
arithmetic as the core does).
3 years ago
Roberto Ierusalimschy
9db4bfed6b
Revamp of format validation in 'string.format'
When calling 'sprintf', not all conversion specifiers accept all
flags; some combinations are undefined behavior.
3 years ago
Roberto Ierusalimschy
a393ac2554
Detail in 'testes/math.lua'
Added a print with the random seeds used in the tests of 'random'.
3 years ago
Roberto Ierusalimschy
65434b4d1b
Option '-l' can give a name for the global variable.
Sintax for this option now is '-l [globname=]modname'.
3 years ago
Roberto Ierusalimschy
59acd79c05
Added tests for string reuse by the scanner
3 years ago
Roberto Ierusalimschy
439e45a2f6
Bug: luaL_tolstring may get confused with negative index
When object has a '__name' metafield, 'luaL_tolstring' used the
received index after pushing a string on the stack.
3 years ago
Roberto Ierusalimschy
62fb934427
Bug: Negation in 'luaV_shiftr' may overflow
Negation of an unchecked lua_Integer overflows with mininteger.
3 years ago
Roberto Ierusalimschy
6a0dace25a
Bug: 'local function' can assign to '<const>' variables
3 years ago
Roberto Ierusalimschy
04e19712a5
C functions can be tail called, too
A tail call to a C function can have the behavior of a "real" tail
call, reusing the stack frame of the caller.
3 years ago