From 891b84a833e8f2753141808c92e171579947dd82 Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Sat, 27 Jun 2020 09:28:49 +0300 Subject: [PATCH] [3.2] Prevents usage of return in main shader functions --- servers/visual/shader_language.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index b400a6e03b2..725c4276180 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -4620,6 +4620,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Mapparent_function && (b->parent_function->name == "vertex" || b->parent_function->name == "fragment" || b->parent_function->name == "light")) { + _set_error(vformat("Using 'return' in '%s' processor function results in undefined behavior!", b->parent_function->name)); + return ERR_PARSE_ERROR; + } + while (b && !b->parent_function) { b = b->parent_block; }