summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
authordzil123 <5725958+dzil123@users.noreply.github.com>2022-11-15 06:51:48 -0800
committerdzil123 <5725958+dzil123@users.noreply.github.com>2022-11-15 06:51:48 -0800
commit6f0cd8072f4808c04038592227c08827f030f627 (patch)
tree69bc0a34e309b16f3d7b42f1f6583ccb28cfa8e9 /servers/rendering
parent245e6454a03a24bf074eb3715776125842e3b666 (diff)
Fix Fog shader buffer overflow
Diffstat (limited to 'servers/rendering')
-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 797e332af0..dd34a7fa4e 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];
}