Skip to content

verify: Reject negative FST start state IDs#246

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara/944930504
Open

verify: Reject negative FST start state IDs#246
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara/944930504

Conversation

@copybara-service

Copy link
Copy Markdown

verify: Reject negative FST start state IDs

Negative state IDs (other than kNoStateId) were previously passing the
initial bounds check because start and ns are signed, making
negative values smaller than ns but still invalid as state IDs. This
led to crashes downstream in ComputeProperties (and potentially other
algorithms).

Explicitly validate that the start state ID is non-negative (or equal
to kNoStateId), returning an InvalidArgumentError if it is invalid.

Negative state IDs (other than `kNoStateId`) were previously passing the
initial bounds check because `start` and `ns` are signed, making
negative values smaller than `ns` but still invalid as state IDs. This
led to crashes downstream in `ComputeProperties` (and potentially other
algorithms).

Explicitly validate that the `start` state ID is non-negative (or equal
to `kNoStateId`), returning an `InvalidArgumentError` if it is invalid.

PiperOrigin-RevId: 944930504
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant