From 22db4657c88105de13ced39726b571f6b8297d8e Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Thu, 11 Jan 2024 15:24:24 +0100 Subject: [PATCH] [Shaders] Disallow trailing commas in function declarations --- servers/rendering/shader_language.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 7c4128b0e378..0e1026c6589e 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -10585,7 +10585,13 @@ Error ShaderLanguage::_parse_shader(const HashMap &p_f if (tk.type == TK_COMMA) { tk = _get_token(); - //do none and go on +#ifdef DISABLE_DEPRECATED + // Disallow trailing comma. + if (tk.type == TK_PARENTHESIS_CLOSE) { + _set_error(RTR("Expected a valid data type for argument. Trailing commas are not allowed.")); + return ERR_PARSE_ERROR; + } +#endif } else if (tk.type != TK_PARENTHESIS_CLOSE) { _set_expected_error(",", ")"); return ERR_PARSE_ERROR;