summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-23 13:51:40 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-24 10:15:31 +0200
commit4350d195b636676ab55439551cc8fae5ee70fad3 (patch)
tree3cdf85fbdaa06b737108b9be130a8de45d4a9828
parent214d745949e33f869751214c0997bf02f63c88b4 (diff)
downloadfengari-4350d195b636676ab55439551cc8fae5ee70fad3.tar.gz
fengari-4350d195b636676ab55439551cc8fae5ee70fad3.tar.bz2
fengari-4350d195b636676ab55439551cc8fae5ee70fad3.zip
Add missing luaD_checkstack in luaD_hook
-rw-r--r--src/ldo.js1
-rw-r--r--tests/test-suite/ltests.js6
2 files changed, 4 insertions, 3 deletions
diff --git a/src/ldo.js b/src/ldo.js
index ab3f197..4c198ee 100644
--- a/src/ldo.js
+++ b/src/ldo.js
@@ -230,6 +230,7 @@ const luaD_hook = function(L, event, line) {
ar.event = event;
ar.currentline = line;
ar.i_ci = ci;
+ luaD_checkstack(L, defs.LUA_MINSTACK); /* ensure minimum stack size */
ci.top = L.top + defs.LUA_MINSTACK;
assert(ci.top <= L.stack_last);
L.allowhook = 0; /* cannot call hooks inside a hook */
diff --git a/tests/test-suite/ltests.js b/tests/test-suite/ltests.js
index 685f530..1c8fe6b 100644
--- a/tests/test-suite/ltests.js
+++ b/tests/test-suite/ltests.js
@@ -379,9 +379,9 @@ const sethook = function(L) {
const smask = lauxlib.luaL_checkstring(L, 2);
let count = lauxlib.luaL_optinteger(L, 3, 0);
let mask = 0;
- if (smask.indexOf('c'.charCodeAt(0))) mask |= lua.LUA_MASKCALL;
- if (smask.indexOf('r'.charCodeAt(0))) mask |= lua.LUA_MASKRET;
- if (smask.indexOf('l'.charCodeAt(0))) mask |= lua.LUA_MASKLINE;
+ if (smask.indexOf('c'.charCodeAt(0)) >= 0) mask |= lua.LUA_MASKCALL;
+ if (smask.indexOf('r'.charCodeAt(0)) >= 0) mask |= lua.LUA_MASKRET;
+ if (smask.indexOf('l'.charCodeAt(0)) >= 0) mask |= lua.LUA_MASKLINE;
if (count > 0) mask |= lua.LUA_MASKCOUNT;
sethookaux(L, mask, count, scpt);
}