mirror of
https://github.com/lua/lua
synced 2024-11-28 07:33:08 +03:00
Tricky _PROMPT may trigger undefined behavior in lua.c
This commit is contained in:
parent
b529aefc53
commit
aaf3533653
5
lua.c
5
lua.c
@ -115,12 +115,13 @@ static void l_message (const char *pname, const char *msg) {
|
||||
|
||||
/*
|
||||
** Check whether 'status' is not OK and, if so, prints the error
|
||||
** message on the top of the stack. It assumes that the error object
|
||||
** is a string, as it was either generated by Lua or by 'msghandler'.
|
||||
** message on the top of the stack.
|
||||
*/
|
||||
static int report (lua_State *L, int status) {
|
||||
if (status != LUA_OK) {
|
||||
const char *msg = lua_tostring(L, -1);
|
||||
if (msg == NULL)
|
||||
msg = "(error message not a string)";
|
||||
l_message(progname, msg);
|
||||
lua_pop(L, 1); /* remove message */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user