diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-06-04 12:55:43 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-06-04 12:55:43 -0300 |
commit | d05fe48bfdd89956c0ebd115dca0fb115aa28dd6 (patch) | |
tree | 2d493691527ee7e47748778f6be14dbd5809095c | |
parent | 519c57d597625f010d1bbb3f91bac5d193111060 (diff) | |
download | lua-d05fe48bfdd89956c0ebd115dca0fb115aa28dd6.tar.gz lua-d05fe48bfdd89956c0ebd115dca0fb115aa28dd6.tar.bz2 lua-d05fe48bfdd89956c0ebd115dca0fb115aa28dd6.zip |
Loading a binary chunk should not break assertions
Although the execution of a bad binary chunk can crash the interpreter,
simply loading it should be safe.
-rw-r--r-- | lundump.c | 2 | ||||
-rw-r--r-- | manual/manual.of | 3 |
2 files changed, 4 insertions, 1 deletions
@@ -234,7 +234,7 @@ static void loadConstants (LoadState *S, Proto *f) { | |||
234 | f->source = NULL; | 234 | f->source = NULL; |
235 | break; | 235 | break; |
236 | } | 236 | } |
237 | default: lua_assert(0); | 237 | default: error(S, "invalid constant"); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | } | 240 | } |
diff --git a/manual/manual.of b/manual/manual.of index a6361fa2..0d473eed 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -1402,6 +1402,9 @@ Chunks can also be precompiled into binary form; | |||
1402 | see the program @idx{luac} and the function @Lid{string.dump} for details. | 1402 | 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, | ||
1406 | the execution of maliciously crafted | ||
1407 | bytecode can crash the interpreter. | ||
1405 | 1408 | ||
1406 | } | 1409 | } |
1407 | 1410 | ||