From 35682d30795498632c0406011e6c56f97a73f1d6 Mon Sep 17 00:00:00 2001 From: George Marques Date: Fri, 2 Apr 2021 10:34:44 -0300 Subject: GDScript: Properly validate return type When the type cannot be validated at compile time, the runtime must do a check to ensure type safety is kept, as the code might be assuming the return type is correct in another place, leading to crashes if the contract is broken. --- modules/gdscript/gdscript_function.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/gdscript/gdscript_function.h') diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h index 41080ef371..9fc75b66ce 100644 --- a/modules/gdscript/gdscript_function.h +++ b/modules/gdscript/gdscript_function.h @@ -306,6 +306,10 @@ public: OPCODE_JUMP_IF_NOT, OPCODE_JUMP_TO_DEF_ARGUMENT, OPCODE_RETURN, + OPCODE_RETURN_TYPED_BUILTIN, + OPCODE_RETURN_TYPED_ARRAY, + OPCODE_RETURN_TYPED_NATIVE, + OPCODE_RETURN_TYPED_SCRIPT, OPCODE_ITERATE_BEGIN, OPCODE_ITERATE_BEGIN_INT, OPCODE_ITERATE_BEGIN_FLOAT, -- cgit v1.2.3