| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
The cast of n (number of repetitions) to size_t may truncate its value,
causing a buffer overflow later. Better to check the buffer size
using lua_Integer, as all string lengths must fit in a lua_Integer and
n already is a lua_Integer. If everything fits in MAX_SIZE, then we can
safely convert n to size_t and compute the buffer size as a size_t.
As a corner case, n can be larger than size_t if the strings being
repeated have length zero, but in this case it will be multiplied by
zero, so an overflow in the cast is irrelevant.
|
|
|
|
|
|
|
| |
A bad actor could fill only a few entries in a table (power of twos in
decreasing order, see tests) and produce a small table with a huge
length. If your program builds a table with external data and iterates
over its length, this behavior could be an issue.
|
|
|
|
| |
Wrong utf-8 character may have no continuation bytes.
|
|
|
|
|
|
|
| |
That complicates a little object equality (and therefore table access
for long strings), but the old behavior was somewhat weird. (Short
strings, a concept otherwise absent from the manual, could not be
external.)
|
|
|
|
|
| |
Bugs in macOS prevent assigning 'add_history' to 'l_addhist' without
a warning.
|
|
|
|
|
|
|
|
|
|
| |
External strings created by DLLs may need the DLL code to be
deallocated. This implies that a DLL can only be unloaded after all
its strings were deallocated, which happen only after the run of all
finalizers. To ensure that order, we create a 'library string' to
represent each DLL and keep it locked. When this string is deallocated
(after the deallocation of any string created by the DLL) it closes its
corresponding DLL.
|
| |
|
| |
|
|
|
|
|
| |
The cast must be made before the shift. If int has 16 bits, the shift
would zero the value and the cast would cast 0 to 0.
|
| |
|
|
|
|
| |
size_t can be smaller than lua_Usigned.
|
|
|
|
|
|
| |
LUAI_MAXSTACK is limited to INT_MAX/2, so can use INT_MAX/2 to define
pseudo-indices (LUA_REGISTRYINDEX) in 'lua.h'. A change in the maximum
stack size does not need to change the Lua-C ABI.
|
| |
|
| |
|
|
|
|
|
| |
MacOS defines 'add_history' with a "wrong" type (it returns 'int'
instead of 'void').
|
| |
|
|
|
|
|
| |
More common code for 'readline' loaded statically or dynamically (or
not loaded).
|
|
|
|
| |
Only local variables, which use registers, need this low limit.
|
|
|
|
|
| |
Lua is not religious about that, but it tries to avoid crashes when
loading binary chunks.
|
|
|
|
|
|
| |
All-weak tables are not being revisited after being visited during
propagation; if it gets a new metatable after that, the new metatable
may not be marked.
|
|
|
|
|
| |
Check the mode in a separate function (getmode), instead of using
comma expressions inside the 'if' condition.
|
|
|
|
|
|
| |
Unlike sizes, these constants can be negative, so it encodes those
integers into unsigned integers in a way that keeps small numbers
small.
|
|
|
|
|
|
| |
No thread started with pcall (instead of resume) can be closed,
because coroutine.close would not respect the expected number of
results from the protected call.
|
|
|
|
|
| |
A call to close itself will close all its to-be-closed variables and
return to the resume that (re)started the coroutine.
|
|
|
|
|
| |
Although the execution of a bad binary chunk can crash the interpreter,
simply loading it should be safe.
|
|
|
|
|
|
|
|
|
| |
In a constructor, each field generates at least one opcode, and the
number of opcodes is limited by INT_MAX. Therefore, the counters for
number of fields cannot exceed this limit. (The current limit for
items in the hash part of a table has a limit smaller than INT_MAX.
However, as long as there are no overflows, the logic for table
resizing will handle that limit.)
|
|
|
|
|
| |
The check for constructor overflow was considering only fields with
explicit names, ignoring fields with syntax '[exp]=exp'.
|
|
|
|
|
| |
Validity of the preambular global declaration in controled together
with all declarations, when checking variable names.
|
|
|
|
|
|
| |
A goto cannot jump into the scope of any variable declaration,
including 'global *'. To report the error, it needs a "name" for
the scope it is entering.
|
|
|
|
|
| |
In this format, the attribute applies to all names in the list;
e.g. "global<const> print, require, math".
|
|
|
|
|
| |
Reports errors with "?:?:" (instead of "?:-1:") when there is no debug
information.
|
| |
|
|
|
|
|
|
| |
The parser uses "break" as fake label to compile "break" as "goto
break". To avoid producing this string at each use, it keeps it
available in its state.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
In preparation for 'global *', the structure 'expdesc' does not point
to 'actvar.arr' for information about global variables.
|
| |
|
|
|
|
|
| |
'l_uint32' is enough for unicode codepoints (versus unsigned long),
and the utf-8 library already uses that type.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Helps to ensure that 'luaO_pushvfstring' is being called correctly,
with an error check after closing the vararg list with 'va_end'.
|
| |
|
|
|
|
|
| |
All calls to 'luaK_semerror' were using 'luaO_pushfstring' to create
the error messages.
|
|
|
|
|
|
| |
In generational collection, objects marked as touched1 stay in gray
lists between collections. This commit fixes a bug introduced in
commit 808976bb59.
|
|
|
|
|
| |
'pushglobalfuncname' can be quite slow (as it traverses all globals and
all loaded modules), so try first to get a name from the code.
|
| |
|
| |
|
|
|
|
|
|
| |
It can be a little slower, but only for quite large stacks and moreover
stack reallocation is not a common operation. With no strong contrary
reason, it is better to follow the standard.
|