mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
Check the stack size before moving elements to the thread.
Some threads have truncated stacks after finishing with an error causing a Lua assertion failure when we put elements on the stack without first checking whether space is available.
This commit is contained in:
parent
0847535287
commit
6bbfb06704
1 changed files with 2 additions and 0 deletions
|
|
@ -261,6 +261,7 @@ static int aux_mutex (lua_State *L)
|
|||
lua_State *thread = lua_tothread(L, lua_upvalueindex(2));
|
||||
lua_pushvalue(L, lua_upvalueindex(3)); // destructor key
|
||||
lua_pushvalue(L, lua_upvalueindex(4)); // destructor
|
||||
luaL_checkstack(thread, 2, "adding destructor");
|
||||
lua_xmove(L, thread, 2);
|
||||
nse_destructor(thread, 'a');
|
||||
nse_restore(thread, 0);
|
||||
|
|
@ -295,6 +296,7 @@ static int aux_mutex_done (lua_State *L)
|
|||
lua_State *thread = lua_tothread(L, 1);
|
||||
lua_pushvalue(L, lua_upvalueindex(1)); // aux_mutex, actual mutex closure
|
||||
lua_pushliteral(L, "done");
|
||||
luaL_checkstack(thread, 2, "aux_mutex_done");
|
||||
lua_xmove(L, thread, 2);
|
||||
if (lua_pcall(thread, 1, 0, 0) != 0) lua_pop(thread, 1); // pop error msg
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue