summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-21 01:04:18 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-21 01:04:18 +0200
commit22874829057e03bbc9aabdad2970048e0b9b9258 (patch)
tree22b5cfe3d5c6f899b3bc2ef5b322166776902a32 /src
parent68f0cab18add59b2d500b70c1f71abf00ef063e6 (diff)
downloadfengari-22874829057e03bbc9aabdad2970048e0b9b9258.tar.gz
fengari-22874829057e03bbc9aabdad2970048e0b9b9258.tar.bz2
fengari-22874829057e03bbc9aabdad2970048e0b9b9258.zip
lua_checkstack did not adjust ci.top
Diffstat (limited to 'src')
-rw-r--r--src/lapi.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lapi.js b/src/lapi.js
index c0e619b..1fb8baa 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -91,7 +91,13 @@ const index2addr_ = function(L, idx) {
};
const lua_checkstack = function(L, n) {
- return L.stack.length < luaconf.LUAI_MAXSTACK;
+ let ci = L.ci;
+ let res = L.stack.length < luaconf.LUAI_MAXSTACK;
+
+ if (res && ci.top < L.top + n)
+ ci.top = L.top + n; /* adjust frame top */
+
+ return res;
};
const lua_xmove = function(from, to, n) {