summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-16 09:23:16 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-16 09:23:16 +0100
commita6a6af32e2b16aa33b45ed4a7e6b6d3350d11cca (patch)
treed6ec0df29caf122a36e94136f406fd7d456c52d0 /servers
parent340e54ab558bb77a98db07be4c7a2d125ed21e8d (diff)
parent6f0cd8072f4808c04038592227c08827f030f627 (diff)
Merge pull request #68718 from dzil123/fix_fog_shader_buffer_overflow
Fix shader compiler asan out of bounds
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/shader_language.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 92e172494e..497e4476d0 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -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];
}