diff options
-rw-r--r-- | lundump.c | 12 | ||||
-rw-r--r-- | manual/manual.of | 12 |
2 files changed, 11 insertions, 13 deletions
@@ -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. | |||
1403 | Programs in source and compiled forms are interchangeable; | 1403 | Programs in source and compiled forms are interchangeable; |
1404 | Lua automatically detects the file type and acts accordingly @seeF{load}. | 1404 | Lua automatically detects the file type and acts accordingly @seeF{load}. |
1405 | Be aware that, unlike source code, | 1405 | Be aware that, unlike source code, |
1406 | the execution of maliciously crafted | 1406 | maliciously crafted binary chunks can crash the interpreter. |
1407 | bytecode 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), | |||
6694 | or @St{bt} (both binary and text). | 6693 | or @St{bt} (both binary and text). |
6695 | The default is @St{bt}. | 6694 | The default is @St{bt}. |
6696 | 6695 | ||
6697 | It is safe to load malformed binary chunks; | 6696 | Lua does not check the consistency of binary chunks. |
6698 | @id{load} signals an appropriate error. | 6697 | Maliciously crafted binary chunks can crash |
6699 | However, | 6698 | the interpreter. |
6700 | Lua does not check the consistency of the code inside binary chunks; | 6699 | You can use the @id{mode} parameter to prevent loading binary chunks. |
6701 | running maliciously crafted bytecode can crash the interpreter. | ||
6702 | 6700 | ||
6703 | } | 6701 | } |
6704 | 6702 | ||