aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-06-04 12:55:43 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-06-04 12:55:43 -0300
commitd05fe48bfdd89956c0ebd115dca0fb115aa28dd6 (patch)
tree2d493691527ee7e47748778f6be14dbd5809095c
parent519c57d597625f010d1bbb3f91bac5d193111060 (diff)
downloadlua-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.c2
-rw-r--r--manual/manual.of3
2 files changed, 4 insertions, 1 deletions
diff --git a/lundump.c b/lundump.c
index fccded7d..b69ec336 100644
--- a/lundump.c
+++ b/lundump.c
@@ -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;
1402see the program @idx{luac} and the function @Lid{string.dump} for details. 1402see 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,
1406the execution of maliciously crafted
1407bytecode can crash the interpreter.
1405 1408
1406} 1409}
1407 1410