[Tarantool-patches] [PATCH luajit 14/19] Fix debug.getinfo() argument check.

Maxim Kokryashkin m.kokryashkin at tarantool.org
Tue Aug 15 16:35:22 MSK 2023


Hi, Sergey!
Thanks for the patch!
Please consider my comments below.

On Wed, Aug 09, 2023 at 06:36:03PM +0300, Sergey Kaplun via Tarantool-patches wrote:
> 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
Typo: s/for the/for/
> consistency with the upstream.
> ---
>  src/lj_debug.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)

Since there were no test with the original fix, it would be nice to
add one.
> 
> 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
Best regards,
Maxim Kokryashkin
> 


More information about the Tarantool-patches mailing list