From: sergos@tarantool.org To: tarantool-patches@freelists.org Subject: [tarantool-patches] [PATCH] luajit: fox for debug.getinfo(1,'>S') Date: Thu, 8 Aug 2019 14:12:22 +0000 [thread overview] Message-ID: <20190808141222.79226-1-sergos@tarantool.org> (raw) fix for the debug machinery in case an extra argument is expected on Lua stack Fixes: #3833 https://github.com/tarantool/luajit/tree/sergos/luajit-gh-509-debug-getinfo-crash --- src/lj_debug.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/lj_debug.c b/src/lj_debug.c index 959dc28..73bd196 100644 --- a/src/lj_debug.c +++ b/src/lj_debug.c @@ -427,12 +427,16 @@ int lj_debug_getinfo(lua_State *L, const char *what, lj_Debug *ar, int ext) TValue *frame = NULL; TValue *nextframe = NULL; GCfunc *fn; - if (*what == '>') { - TValue *func = L->top - 1; - api_check(L, tvisfunc(func)); - fn = funcV(func); - L->top--; - what++; + if (*what == '>') { /* we have to have an extra arg on stack */ + if (lua_gettop(L) > 2) { + TValue *func = L->top - 1; + api_check(L, tvisfunc(func)); + fn = funcV(func); + L->top--; + what++; + } else { /* need better error to display? */ + return 0; + } } else { uint32_t offset = (uint32_t)ar->i_ci & 0xffff; uint32_t size = (uint32_t)ar->i_ci >> 16; -- 2.17.1
next reply other threads:[~2019-08-08 14:12 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-08 14:12 sergos [this message] 2019-08-15 11:35 ` [tarantool-patches] " Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190808141222.79226-1-sergos@tarantool.org \ --to=sergos@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] [PATCH] luajit: fox for debug.getinfo(1,'\''>S'\'')' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox