From 22874829057e03bbc9aabdad2970048e0b9b9258 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Sun, 21 May 2017 01:04:18 +0200 Subject: lua_checkstack did not adjust ci.top --- src/lapi.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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) { -- cgit v1.2.3-70-g09d2