[Tarantool-patches] [PATCH luajit 14/19] Fix debug.getinfo() argument check.
Sergey Kaplun
skaplun at tarantool.org
Wed Aug 9 18:36:03 MSK 2023
From: Mike Pall <mike>
Thanks to Sergey Ostanevich.
(cherry-picked from commit 0cd643d7cfc21bc8b6153d42b86a71d557270988)
This patch just reverts the commit
48f463e613db6264bfa9acb581fe1ca702ea38eb ("luajit: fox for
debug.getinfo(1,'>S')") and applies the one from the main repo for the
consistency with the upstream.
---
src/lj_debug.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/lj_debug.c b/src/lj_debug.c
index 654dc913..c4edcabb 100644
--- a/src/lj_debug.c
+++ b/src/lj_debug.c
@@ -431,16 +431,12 @@ 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 == '>') { /* 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;
- }
+ if (*what == '>') {
+ TValue *func = L->top - 1;
+ if (!tvisfunc(func)) return 0;
+ fn = funcV(func);
+ L->top--;
+ what++;
} else {
uint32_t offset = (uint32_t)ar->i_ci & 0xffff;
uint32_t size = (uint32_t)ar->i_ci >> 16;
--
2.41.0
More information about the Tarantool-patches
mailing list