Skip to content

Fix incorrect uniform buffer sizes - #347

Open
djefrey wants to merge 1 commit into
Engine-Room:26.1.2/devfrom
djefrey:26.1.2/fix-incorrect-uniform-sizes
Open

djefrey wants to merge 1 commit into
Engine-Room:26.1.2/devfrom
djefrey:26.1.2/fix-incorrect-uniform-sizes

Conversation

@djefrey

@djefrey djefrey commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

FrameUniforms.SIZE and LevelUniforms.SIZE are incorrect.
The align16 in UniformBuffer results in large enough mallocs, so no buffer overflow occurs.

Uniform buffers were tested by adding this code at the end of each update implementation

var usedBytes = ptr - BUFFER.ptr();
var allocBytes = MoreMath.align16(SIZE);
if (usedBytes > allocBytes)
{
    FlwBackend.LOGGER.error("Buffer overflow: {} / {}", usedBytes, allocBytes);
}
else if (usedBytes > SIZE)
{
    FlwBackend.LOGGER.error("Invalid size: {} / {}", usedBytes, SIZE);
}

align16 prevented buffer overflows in both cases

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant