Browse Source

Merge pull request #108568 from beicause/RD-uniform_type-check

RenderingDevice: Add `uniform_type` check to avoid crash
Thaddeus Crews 1 month ago
parent
commit
723e82bba9
1 changed files with 1 additions and 0 deletions
  1. 1 0
      servers/rendering/rendering_device.cpp

+ 1 - 0
servers/rendering/rendering_device.cpp

@@ -3577,6 +3577,7 @@ RID RenderingDevice::uniform_set_create(const VectorView<RD::Uniform> &p_uniform
 
 
 		const Uniform &uniform = uniforms[uniform_idx];
 		const Uniform &uniform = uniforms[uniform_idx];
 
 
+		ERR_FAIL_INDEX_V(uniform.uniform_type, RD::UNIFORM_TYPE_MAX, RID());
 		ERR_FAIL_COND_V_MSG(uniform.uniform_type != set_uniform.type, RID(),
 		ERR_FAIL_COND_V_MSG(uniform.uniform_type != set_uniform.type, RID(),
 				"Mismatch uniform type for binding (" + itos(set_uniform.binding) + "), set (" + itos(p_shader_set) + "). Expected '" + SHADER_UNIFORM_NAMES[set_uniform.type] + "', supplied: '" + SHADER_UNIFORM_NAMES[uniform.uniform_type] + "'.");
 				"Mismatch uniform type for binding (" + itos(set_uniform.binding) + "), set (" + itos(p_shader_set) + "). Expected '" + SHADER_UNIFORM_NAMES[set_uniform.type] + "', supplied: '" + SHADER_UNIFORM_NAMES[uniform.uniform_type] + "'.");