From d05fe48bfdd89956c0ebd115dca0fb115aa28dd6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 4 Jun 2025 12:55:43 -0300 Subject: 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. --- lundump.c | 2 +- manual/manual.of | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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) { f->source = NULL; break; } - default: lua_assert(0); + default: error(S, "invalid constant"); } } } 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; see the program @idx{luac} and the function @Lid{string.dump} for details. Programs in source and compiled forms are interchangeable; Lua automatically detects the file type and acts accordingly @seeF{load}. +Be aware that, unlike source code, +the execution of maliciously crafted +bytecode can crash the interpreter. } -- cgit v1.2.3-55-g6feb