Merge pull request #68718 from dzil123/fix_fog_shader_buffer_overflow

Fix shader compiler asan out of bounds
This commit is contained in:
Rémi Verschelde 2022-11-16 09:23:16 +01:00
commit a6a6af32e2
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -4309,8 +4309,18 @@ ShaderLanguage::DataType ShaderLanguage::get_scalar_type(DataType p_type) {
TYPE_INT,
TYPE_UINT,
TYPE_FLOAT,
TYPE_INT,
TYPE_UINT,
TYPE_FLOAT,
TYPE_INT,
TYPE_UINT,
TYPE_FLOAT,
TYPE_FLOAT,
TYPE_VOID,
};
static_assert(sizeof(scalar_types) / sizeof(*scalar_types) == TYPE_MAX);
return scalar_types[p_type];
}
@ -4340,8 +4350,18 @@ int ShaderLanguage::get_cardinality(DataType p_type) {
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
};
static_assert(sizeof(cardinality_table) / sizeof(*cardinality_table) == TYPE_MAX);
return cardinality_table[p_type];
}