Skip to content

hlslparser: Reject identifiers longer than the tokenizer buffer - #1049

Open
crmne wants to merge 1 commit into
projectM-visualizer:masterfrom
crmne:hlslparser-identifier-length
Open

crmne wants to merge 1 commit into
projectM-visualizer:masterfrom
crmne:hlslparser-identifier-length

Conversation

@crmne

@crmne crmne commented Oct 15, 2026

Copy link
Copy Markdown

HLSLTokenizer::Next copies each identifier into m_identifier (s_maxIdentifier, 256 bytes) without checking its length, so a preset shader with an identifier longer than 255 characters writes past the buffer.

This reports a syntax error and ends the token stream instead, matching how the #line file name is already bounded.

Checked with AddressSanitizer on a small harness around the tokenizer: the overflow reproduces on master and is gone with this change.

As discussed with @kblaschke, this should also be cherry-picked to v4.1.x.

HLSLTokenizer::Next copied identifiers into the fixed-size m_identifier
buffer without checking their length. Report an error and stop
tokenizing instead, as the #line file name already does.

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