aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* More checks and documentation for uses of EXTRA_STACKRoberto Ierusalimschy2022-05-265-13/+47
|
* Bug: 'lua_settop' may use an invalid pointer to stackRoberto Ierusalimschy2022-05-255-12/+34
|
* 'luaV_concat' can use invalidated pointer to stackRoberto Ierusalimschy2022-05-231-3/+3
| | | | Bug introduced in commit 42d40581.
* 'lua_checkstack' doesn't need to check stack overflowRoberto Ierusalimschy2022-05-235-26/+17
| | | | | | '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'.
* Save stack space while handling errorsRoberto Ierusalimschy2022-05-202-3/+8
| | | | | | | | | | Because error handling (luaG_errormsg) uses slots from EXTRA_STACK, and some errors can recur (e.g., string overflow while creating an error message in 'luaG_runerror', or a C-stack overflow before calling the message handler), the code should use stack slots with parsimony. This commit fixes the bug "Lua-stack overflow when C stack overflows while handling an error".
* Details (identation and typos)Roberto Ierusalimschy2022-05-102-3/+4
|
* Factoring out common parts of 'codearith' and 'codebitwise'Roberto Ierusalimschy2022-05-061-25/+33
|
* Bug: Wrong code generation in bitwise operationsRoberto Ierusalimschy2022-04-253-6/+42
|
* New release number (5.4.5)Roberto Ierusalimschy2022-04-071-2/+2
|
* DetailsRoberto Ierusalimschy2022-04-014-6/+17
| | | | | Comments + manual + identation + asserts about stack limits that were not allowing the use of the full stack
* Avoid computing invalid addressesRoberto Ierusalimschy2022-02-181-32/+89
| | | | | | luaV_execute should compute 'ra' only when the instruction uses it. Computing an illegal address is undefined behavior even if the address is never dereferenced.
* Bug: Lua can generate wrong code when _ENV is <const>Roberto Ierusalimschy2022-02-152-0/+11
|
* Bug: lua.c assumes that argv has at least one elementRoberto Ierusalimschy2022-02-071-12/+23
|
* Explanation of borders in the manualv5.4.4Roberto Ierusalimschy2022-01-131-10/+12
| | | | | | The explanation includes the limit case of maxinteger being a border. It also avoids the term "natural", which might include large floats with natural values.
* DetailRoberto Ierusalimschy2022-01-033-8/+8
| | | | Warnings with clang when using long double for Lua floats.
* New year (2022)Roberto Ierusalimschy2022-01-022-3/+3
|
* Bug: finalizer calling exit can corrupt finalization orderRoberto Ierusalimschy2021-12-223-5/+34
| | | | | 'os.exit' can call lua_close again, separating new finalizers created after all previous finalizers were already separated.
* DetailsRoberto Ierusalimschy2021-12-212-2/+2
| | | | correction in macro for hard tests + type in comment
* Bug: finalizers can be called with an invalid stackRoberto Ierusalimschy2021-12-151-1/+1
| | | | | The call to 'checkstackGC' can run finalizers, which will find an inconsistent CallInfo, as 'ci' is half updated at the point of call.
* Fix debug information about finalizersRoberto Ierusalimschy2021-12-145-27/+35
| | | | | | 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.)
* Bug: GC is not reentrantRoberto Ierusalimschy2021-12-139-27/+57
| | | | As the GC is not reentrant, finalizers should not be able to invoke it.
* Bug: Lua stack still active when closing a stateRoberto Ierusalimschy2021-12-101-0/+1
|
* Main 'mainposition' replaced by 'mainpositionTV'Roberto Ierusalimschy2021-11-251-19/+16
| | | | | Handle values in table keys as the special cases they are, and not the other way around.
* Wrong assert in 'collectvalidlines'Roberto Ierusalimschy2021-11-252-2/+2
|
* Corrected bug in 'luaD_tryfuncTM'Roberto Ierusalimschy2021-11-162-2/+3
| | | | | | The pointer to the metamethod can be invalidated by a finalizer that can run during a GC in 'checkstackGCp'. (This commit also fixes a detail in the manual.) Bug introduced in commit 91673a8ec.
* Avoid OP_VARARGPREP for active linesRoberto Ierusalimschy2021-11-102-1/+51
| | | | | when building the table 'activelines' for a vararg function, this first instruction does not make the first line active.
* Bug: Wrong status in coroutine during resetRoberto Ierusalimschy2021-11-083-5/+47
| | | | | | | | | 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.
* Bug: C stack overflow with coroutinesRoberto Ierusalimschy2021-11-032-2/+18
| | | | | | 'coroutine.resume' did not increment counter of C calls when continuing execution after a protected error (that is, while running 'precover').
* More uniform implementation for tail callsRoberto Ierusalimschy2021-10-293-44/+58
| | | | | | | | | | | 'luaD_pretailcall' mimics 'luaD_precall', handling call metamethods and calling C functions directly. That makes the code in the interpreter loop simpler. This commit also goes back to emulating the tail call in 'luaD_precall' with a goto, as C compilers may not do proper tail calls and the C stack can overflow much sooner than the Lua stack (which grows as the metamethod is added to it).
* Removed goto's in 'luaD_precall'Roberto Ierusalimschy2021-10-182-25/+28
| | | | (plus a detail in lauxlib.h.)
* Avoid taking the address of a 'TValue' fieldRoberto Ierusalimschy2021-10-112-10/+10
| | | | That structure can be packed in the future.
* DocumentationRoberto Ierusalimschy2021-10-114-5/+13
| | | | | Better explanation about the guaranties of multiple assignment in the manual.
* Avoid overflows when incrementing parameters in CRoberto Ierusalimschy2021-09-226-9/+39
| | | | | | 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).
* Using 'inline' in some functionsRoberto Ierusalimschy2021-09-155-15/+32
| | | | | According to ISO C, "making a function an inline function suggests that calls to the function be as fast as possible." (Not available in C89.)
* Revamp of format validation in 'string.format'Roberto Ierusalimschy2021-09-033-36/+118
| | | | | When calling 'sprintf', not all conversion specifiers accept all flags; some combinations are undefined behavior.
* 'luaD_tryfuncTM' checks stack space by itselfRoberto Ierusalimschy2021-08-183-9/+11
|
* Undo simplification of tail calls (commit 901d760)Roberto Ierusalimschy2021-08-183-51/+51
| | | | Not that simpler and slower.
* Detail in 'testes/math.lua'Roberto Ierusalimschy2021-08-181-0/+1
| | | | Added a print with the random seeds used in the tests of 'random'.
* Option '-l' can give a name for the global variable.Roberto Ierusalimschy2021-08-162-15/+27
| | | | Sintax for this option now is '-l [globname=]modname'.
* Added tests for string reuse by the scannerRoberto Ierusalimschy2021-08-112-1/+25
|
* Improved documentation for 'lua_getinfo'Roberto Ierusalimschy2021-08-111-18/+24
|
* Bug: luaL_tolstring may get confused with negative indexRoberto Ierusalimschy2021-07-223-0/+20
| | | | | When object has a '__name' metafield, 'luaL_tolstring' used the received index after pushing a string on the stack.
* Bug: Negation in 'luaV_shiftr' may overflowRoberto Ierusalimschy2021-07-222-1/+6
| | | | Negation of an unchecked lua_Integer overflows with mininteger.
* Correction on documentation of string-buffer operationsRoberto Ierusalimschy2021-07-211-4/+4
| | | | | | All string-buffer operations can potentially change the stack in unspecified ways; the push/pop documentation in the manual should reflect that.
* Simplification in the parameters of 'luaD_precall'Roberto Ierusalimschy2021-06-303-14/+24
| | | | | | The parameters 'nresults' and 'delta1', in 'luaD_precall', were never meaningful simultaneously. So, they were combined in a single parameter 'retdel'.
* Bug: 'local function' can assign to '<const>' variablesRoberto Ierusalimschy2021-06-202-0/+3
|
* C functions can be tail called, tooRoberto Ierusalimschy2021-06-144-29/+29
| | | | | A tail call to a C function can have the behavior of a "real" tail call, reusing the stack frame of the caller.
* Simpler implementation for tail callsRoberto Ierusalimschy2021-06-113-39/+33
| | | | | Tail calls handled by 'luaD_precall', like regular calls, to avoid code duplication.
* Avoid the term "undefined behavior" in the manualRoberto Ierusalimschy2021-06-091-3/+2
|
* 'index2value' more robustRoberto Ierusalimschy2021-05-241-5/+13
| | | | | 'index2value' accepts pseudo-indices also when called from a Lua function, through a hook.