diff options
author | Alex Hirsch <w4rh4wk@bluephoenix.at> | 2021-03-04 18:44:30 +0100 |
---|---|---|
committer | Alex Hirsch <w4rh4wk@bluephoenix.at> | 2021-03-04 18:50:37 +0100 |
commit | 6985967c3bbfbc96e60fdd5ec6136d209c3d5210 (patch) | |
tree | d08574e86c2ef26c9345174e42c40c42eb5c4015 /core/variant | |
parent | 4c10d31bc42f0d01d1b6a8042413a8886d19f987 (diff) |
Add missing ERR_FAIL_INDEX check to Variant::construct
Other functions in the same file validate parameters using the ERR_FAIL
macros. This validation was missing for Variant::construct resulting in
a crash when called with invalid data (p_type < 0).
fix #46067
Diffstat (limited to 'core/variant')
-rw-r--r-- | core/variant/variant_construct.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp index 52f9f6060e..f0c9e52b46 100644 --- a/core/variant/variant_construct.cpp +++ b/core/variant/variant_construct.cpp @@ -773,6 +773,7 @@ void Variant::_unregister_variant_constructors() { } void Variant::construct(Variant::Type p_type, Variant &base, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { + ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX); uint32_t s = construct_data[p_type].size(); for (uint32_t i = 0; i < s; i++) { int argc = construct_data[p_type][i].argument_count; |