Skip to content

Reject negative choice values in SetType#1112

Open
raphaelroshan wants to merge 1 commit into
aeron-io:masterfrom
raphaelroshan:fix/settype-reject-negative-choice
Open

Reject negative choice values in SetType#1112
raphaelroshan wants to merge 1 commit into
aeron-io:masterfrom
raphaelroshan:fix/settype-reject-negative-choice

Conversation

@raphaelroshan

Copy link
Copy Markdown

A <choice> value is a bit position and must be in [0, size * 8). The bounds check only guarded the upper limit, so a negative value (e.g. -1) passed schema validation and was later emitted as a shift amount in generated code, where 1 << -1 is silently masked to 1 << 31 — producing wrong encode/decode masking for an invalid schema.

Reject negative values too (value < 0 || value >= size * 8). Added a test symmetric to the existing upper-bound one.

A <choice> value is a bit position and must be in [0, size * 8). The
bounds check only guarded the upper limit, so a negative value passed
validation and was later emitted as a shift amount in generated code,
where 1 << -1 is silently masked to 1 << 31 -- producing wrong
encode/decode masking for an invalid schema. Reject negative values too.
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