From fbaf040f5effae90214887d10bfac710b836f281 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 25 Sep 2020 10:49:29 -0300 Subject: [PATCH] Details in the manual --- manual/manual.of | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/manual/manual.of b/manual/manual.of index ff891399..8b34b5bd 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -2441,7 +2441,8 @@ to ensure that the stack has enough space for pushing new elements. Whenever Lua calls C, it ensures that the stack has space for -at least @defid{LUA_MINSTACK} extra slots. +at least @defid{LUA_MINSTACK} extra elements; +that is, you can safely push up to @id{LUA_MINSTACK} values into it. @id{LUA_MINSTACK} is defined as 20, so that usually you do not have to worry about stack space unless your code has loops pushing elements onto the stack. @@ -3061,7 +3062,7 @@ static int foo (lua_State *L) { @APIEntry{int lua_checkstack (lua_State *L, int n);| @apii{0,0,-} -Ensures that the stack has space for at least @id{n} extra slots, +Ensures that the stack has space for at least @id{n} extra elements, that is, that you can safely push up to @id{n} values into it. It returns false if it cannot fulfill the request, either because it would cause the stack @@ -3069,7 +3070,7 @@ to be greater than a fixed maximum size (typically at least several thousand elements) or because it cannot allocate memory for the extra space. This function never shrinks the stack; -if the stack already has space for the extra slots, +if the stack already has space for the extra elements, it is left unchanged. } @@ -6313,9 +6314,11 @@ It may be the string @St{b} (only @x{binary chunk}s), or @St{bt} (both binary and text). The default is @St{bt}. -Lua does not check the consistency of binary chunks. -Maliciously crafted binary chunks can crash -the interpreter. +It is safe to load malformed binary chunks; +@id{load} signals an appropriate error. +However, +Lua does not check the consistency of the code inside binary chunks; +running maliciously crafted bytecode can crash the interpreter. }