From 6832cfbf046c6ac01a0d89c3f7c62349de21545d Mon Sep 17 00:00:00 2001 From: Florian Date: Fri, 17 May 2024 20:24:09 +0200 Subject: [PATCH] Fix an off-by-one error in interpreter's `do_invoke` (#54443) --- src/interpreter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interpreter.c b/src/interpreter.c index d84a1381fccad9..570fda51a989b6 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -135,10 +135,10 @@ static jl_value_t *do_invoke(jl_value_t **args, size_t nargs, interpreter_state JL_GC_PUSHARGS(argv, nargs - 1); size_t i; for (i = 1; i < nargs; i++) - argv[i] = eval_value(args[i], s); + argv[i-1] = eval_value(args[i], s); jl_method_instance_t *meth = (jl_method_instance_t*)args[0]; assert(jl_is_method_instance(meth)); - jl_value_t *result = jl_invoke(argv[1], &argv[2], nargs - 2, meth); + jl_value_t *result = jl_invoke(argv[0], nargs == 2 ? NULL : &argv[1], nargs - 2, meth); JL_GC_POP(); return result; }