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

Fix validation of unused LEB128 bits #6680

Merged
merged 2 commits into from
Jun 19, 2024
Merged

Fix validation of unused LEB128 bits #6680

merged 2 commits into from
Jun 19, 2024

Conversation

tlively
Copy link
Member

@tlively tlively commented Jun 18, 2024

The unused bits must be a sign extension of the significant value, but we were
previously only validating that unsigned LEBs had their unused bytes set to
zero. Re-enable the spec test that checks for proper validation.

@tlively tlively requested a review from kripken June 18, 2024 22:47
: ((mask_type(1) << (sizeof(T) * 8 - shift)) - 1u);
T significant_payload = payload_mask & payload;
value |= significant_payload << shift;
T unused_bits_mask = ~payload_mask & 0x7F;
Copy link
Member

Choose a reason for hiding this comment

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

We have 127 and 128 above, so perhaps replace 0x7F with that, or replace the above with hex?

@tlively tlively force-pushed the spec-test-globals branch from c8968e0 to 53f3d0f Compare June 19, 2024 00:23
@tlively tlively force-pushed the spec-test-leb128 branch from 782d30a to c4bd0b4 Compare June 19, 2024 00:24
Base automatically changed from spec-test-globals to main June 19, 2024 01:35
tlively added 2 commits June 18, 2024 18:36
The unused bits must be a sign extension of the significant value, but we were
previously only validating that unsigned LEBs had their unused bytes set to
zero. Re-enable the spec test that checks for proper validation.
@tlively tlively force-pushed the spec-test-leb128 branch from c4bd0b4 to 5c8bd00 Compare June 19, 2024 01:36
@tlively tlively enabled auto-merge (squash) June 19, 2024 01:36
@tlively tlively merged commit 3acacac into main Jun 19, 2024
13 checks passed
@tlively tlively deleted the spec-test-leb128 branch June 19, 2024 02:12
@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