From e34241a809dea9537bc32c40b1fad47b31025628 Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:11:08 +0200 Subject: [PATCH] Fix arg count checks in SceneDebugger (cherry picked from commit 95809e58d5fd888fa3e5d86ffc071bb4b18ddbb4) --- scene/debugger/scene_debugger.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index 391388fc04d..4b097412d6e 100644 --- a/scene/debugger/scene_debugger.cpp +++ b/scene/debugger/scene_debugger.cpp @@ -163,6 +163,7 @@ Error SceneDebugger::parse_message(void *p_user, const String &p_msg, const Arra live_editor->_res_set_func(p_args[0], p_args[1], p_args[2]); } else if (p_msg == "live_node_call") { + ERR_FAIL_COND_V(p_args.size() < 2, ERR_INVALID_DATA); LocalVector args; LocalVector argptrs; args.resize(p_args.size() - 2); @@ -171,11 +172,10 @@ Error SceneDebugger::parse_message(void *p_user, const String &p_msg, const Arra args[i] = p_args[i + 2]; argptrs[i] = &args[i]; } - live_editor->_node_call_func(p_args[0], p_args[1], (const Variant **)argptrs.ptr(), argptrs.size()); + live_editor->_node_call_func(p_args[0], p_args[1], argptrs.size() ? (const Variant **)argptrs.ptr() : nullptr, argptrs.size()); } else if (p_msg == "live_res_call") { - ERR_FAIL_COND_V(p_args.size() < 10, ERR_INVALID_DATA); - + ERR_FAIL_COND_V(p_args.size() < 2, ERR_INVALID_DATA); LocalVector args; LocalVector argptrs; args.resize(p_args.size() - 2); @@ -184,7 +184,7 @@ Error SceneDebugger::parse_message(void *p_user, const String &p_msg, const Arra args[i] = p_args[i + 2]; argptrs[i] = &args[i]; } - live_editor->_res_call_func(p_args[0], p_args[1], (const Variant **)argptrs.ptr(), argptrs.size()); + live_editor->_res_call_func(p_args[0], p_args[1], argptrs.size() ? (const Variant **)argptrs.ptr() : nullptr, argptrs.size()); } else if (p_msg == "live_create_node") { ERR_FAIL_COND_V(p_args.size() < 3, ERR_INVALID_DATA);