From c931d86e98da320c71da70c16d44aa28e9755520 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 12 Mar 2025 15:51:16 -0300 Subject: 'luaD_seterrorobj' should not raise errors This function can be called unprotected, so it should not raise any kind of errors. (It could raise a memory-allocation error when creating a message). --- ldebug.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ldebug.c') diff --git a/ldebug.c b/ldebug.c index 18bdc595..a3202981 100644 --- a/ldebug.c +++ b/ldebug.c @@ -832,6 +832,10 @@ l_noret luaG_errormsg (lua_State *L) { L->top.p++; /* assume EXTRA_STACK */ luaD_callnoyield(L, L->top.p - 2, 1); /* call it */ } + if (ttisnil(s2v(L->top.p - 1))) { /* error object is nil? */ + /* change it to a proper message */ + setsvalue2s(L, L->top.p - 1, luaS_newliteral(L, "")); + } luaD_throw(L, LUA_ERRRUN); } -- cgit v1.2.3-55-g6feb