Fix push constant CString storing garbage past null terminator (#9944)

This commit is contained in:
Ben Doherty
2026-05-01 14:44:54 -07:00
committed by GitHub
parent fd0a0c4781
commit 0027b4b68c

View File

@@ -574,13 +574,15 @@ void MaterialDefinition::processPushConstants() {
[&](MaterialPushConstant const& constant) {
snprintf(buf, sizeof(buf), "%s.%s", structVarName.c_str(), constant.name.c_str());
CString const cs(buf, strlen(buf));
switch (constant.stage) {
case ShaderStage::VERTEX:
vertexConstants.push_back({CString(buf), constant.type});
vertexConstants.push_back({cs, constant.type});
vertexCount++;
break;
case ShaderStage::FRAGMENT:
fragmentConstants.push_back({CString(buf), constant.type});
fragmentConstants.push_back({cs, constant.type});
fragmentCount++;
break;
case ShaderStage::COMPUTE: