aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lundump.c12
-rw-r--r--manual/manual.of12
2 files changed, 11 insertions, 13 deletions
diff --git a/lundump.c b/lundump.c
index 10528987..ade40384 100644
--- a/lundump.c
+++ b/lundump.c
@@ -154,8 +154,9 @@ static void loadString (LoadState *S, Proto *p, TString **sl) {
154 else if (size == 1) { /* previously saved string? */ 154 else if (size == 1) { /* previously saved string? */
155 lua_Unsigned idx = loadVarint(S, LUA_MAXUNSIGNED); /* get its index */ 155 lua_Unsigned idx = loadVarint(S, LUA_MAXUNSIGNED); /* get its index */
156 TValue stv; 156 TValue stv;
157 luaH_getint(S->h, l_castU2S(idx), &stv); /* get its value */ 157 if (novariant(luaH_getint(S->h, l_castU2S(idx), &stv)) != LUA_TSTRING)
158 *sl = ts = tsvalue(&stv); 158 error(S, "invalid string index");
159 *sl = ts = tsvalue(&stv); /* get its value */
159 luaC_objbarrier(L, p, ts); 160 luaC_objbarrier(L, p, ts);
160 return; /* do not save it again */ 161 return; /* do not save it again */
161 } 162 }
@@ -394,11 +395,10 @@ LClosure *luaU_undump (lua_State *L, ZIO *Z, const char *name, int fixed) {
394 LoadState S; 395 LoadState S;
395 LClosure *cl; 396 LClosure *cl;
396 if (*name == '@' || *name == '=') 397 if (*name == '@' || *name == '=')
397 S.name = name + 1; 398 name = name + 1;
398 else if (*name == LUA_SIGNATURE[0]) 399 else if (*name == LUA_SIGNATURE[0])
399 S.name = "binary string"; 400 name = "binary string";
400 else 401 S.name = name;
401 S.name = name;
402 S.L = L; 402 S.L = L;
403 S.Z = Z; 403 S.Z = Z;
404 S.fixed = cast_byte(fixed); 404 S.fixed = cast_byte(fixed);
diff --git a/manual/manual.of b/manual/manual.of
index baa33d88..5bab781b 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -1403,8 +1403,7 @@ see the program @idx{luac} and the function @Lid{string.dump} for details.
1403Programs in source and compiled forms are interchangeable; 1403Programs in source and compiled forms are interchangeable;
1404Lua automatically detects the file type and acts accordingly @seeF{load}. 1404Lua automatically detects the file type and acts accordingly @seeF{load}.
1405Be aware that, unlike source code, 1405Be aware that, unlike source code,
1406the execution of maliciously crafted 1406maliciously crafted binary chunks can crash the interpreter.
1407bytecode can crash the interpreter.
1408 1407
1409} 1408}
1410 1409
@@ -6694,11 +6693,10 @@ It may be the string @St{b} (only @x{binary chunk}s),
6694or @St{bt} (both binary and text). 6693or @St{bt} (both binary and text).
6695The default is @St{bt}. 6694The default is @St{bt}.
6696 6695
6697It is safe to load malformed binary chunks; 6696Lua does not check the consistency of binary chunks.
6698@id{load} signals an appropriate error. 6697Maliciously crafted binary chunks can crash
6699However, 6698the interpreter.
6700Lua does not check the consistency of the code inside binary chunks; 6699You can use the @id{mode} parameter to prevent loading binary chunks.
6701running maliciously crafted bytecode can crash the interpreter.
6702 6700
6703} 6701}
6704 6702