Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assembler: ensure progress when seeking the version string #5910

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
assembler: ensure progress when seeking the version string
When trying to parse SPIR-V version from assembly comments,
ensure a match against an initial comment doesn't cause the
scanner to go back to the beginning of the assembly text.

Fixed: #5909
dneto0 committed Dec 10, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 54fe4433ad23d4bd92ef5ddf0d1e864505adf737
2 changes: 1 addition & 1 deletion source/spirv_target_env.cpp
Original file line number Diff line number Diff line change
@@ -230,7 +230,7 @@ bool spvReadEnvironmentFromText(const std::vector<char>& text,
// If no match, determine whether the header has ended (in which case,
// assumption has failed.)
// Skip until the next line.
i = j;
i += j;
for (; i < text.size(); ++i) {
if (text[i] == '\n') break;
}
1 change: 1 addition & 0 deletions test/target_env_test.cpp
Original file line number Diff line number Diff line change
@@ -221,6 +221,7 @@ INSTANTIATE_TEST_SUITE_P(
{" \t ; Version: 1.1", true, SPV_ENV_UNIVERSAL_1_1},
// Previous lines
{"; SPIR-V\n; Version: 1.1", true, SPV_ENV_UNIVERSAL_1_1},
{"; -\n; SPIR-V\n; Version: 1.1", true, SPV_ENV_UNIVERSAL_1_1},

// After a non-header line
{"OpCapability Shader\n; Version: 1.1", false, kSentinelEnv}}));