Skip to content

Fix unvalidated arc count and integer overflow in VectorFst deserialization. - #265

Merged
copybara-service[bot] merged 1 commit into
mainfrom
copybara/954551590
Jul 27, 2026
Merged

Fix unvalidated arc count and integer overflow in VectorFst deserialization.#265
copybara-service[bot] merged 1 commit into
mainfrom
copybara/954551590

Conversation

@copybara-service

Copy link
Copy Markdown

Fix unvalidated arc count and integer overflow in VectorFst deserialization.

In VectorFst::Read, validate that the serialized arc count (narcs) is non-negative and does not cause integer overflow when calculating required memory before reserving arc storage. Also add unit tests to verifying rejection of negative and oversized arc counts.

Note: This is a partial fix that addresses negative arc counts and integer overflows. Large arc counts that do not trigger 64-bit integer overflow (e.g., 1 billion arcs, which would attempt to allocate ~24 GB of RAM) currently remain unvalidated without stream bounding or maximum allocation limits.

@copybara-service
copybara-service Bot force-pushed the copybara/954551590 branch 2 times, most recently from bbdf598 to bcd804d Compare July 27, 2026 13:01
…zation.

In `VectorFst::Read`, validate that the serialized arc count (`narcs`) is non-negative and does not cause integer overflow when calculating required memory before reserving arc storage. Also add unit tests to verifying rejection of negative and oversized arc counts.

**Note**: This is a partial fix that addresses negative arc counts and integer overflows. Large arc counts that do not trigger 64-bit integer overflow (e.g., 1 billion arcs, which would attempt to allocate ~24 GB of RAM) currently remain unvalidated without stream bounding or maximum allocation limits.

PiperOrigin-RevId: 954590203
@copybara-service
copybara-service Bot force-pushed the copybara/954551590 branch from bcd804d to 1c4ccf3 Compare July 27, 2026 13:21
@copybara-service
copybara-service Bot merged commit 1c4ccf3 into main Jul 27, 2026
@copybara-service
copybara-service Bot deleted the copybara/954551590 branch July 27, 2026 13:21
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