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

Reject invalid section IDs #6675

Merged
merged 2 commits into from
Jun 18, 2024
Merged

Reject invalid section IDs #6675

merged 2 commits into from
Jun 18, 2024

Conversation

tlively
Copy link
Member

@tlively tlively commented Jun 18, 2024

Rather than treating them as custom sections. Also fix UB where invalid
Section enum values could be used as keys in a map. Use the raw uint8_t
section IDs as keys instead. Re-enable a disabled spec test that was failing
because of this bug and UB.

Rather than treating them as custom sections. Also fix UB where invalid
`Section` enum values could be used as keys in a map. Use the raw `uint8_t`
section IDs as keys instead. Re-enable a disabled spec test that was failing
because of this bug and UB.
@tlively tlively requested a review from kripken June 18, 2024 00:05
sectionCode != BinaryConsts::Section::Code) {
if (!seenSections.insert(BinaryConsts::Section(sectionCode)).second) {
if (sectionCode != BinaryConsts::Section::Custom) {
if (!seenSections.insert(sectionCode).second) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ifs can be combined into a single if?

@tlively tlively enabled auto-merge (squash) June 18, 2024 17:54
@tlively tlively merged commit c3b9cde into main Jun 18, 2024
13 checks passed
@tlively tlively deleted the malformed-custom-section-id branch June 18, 2024 18:13
@gkdn gkdn mentioned this pull request Aug 31, 2024
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.

2 participants