Skip to content

fix(rust): bound decoder allocations and pre-size encoded frames - #68

Open
petralithic wants to merge 1 commit into
loro-dev:mainfrom
petralithic:pr/bounded-protocol-codec-20261110
Open

petralithic wants to merge 1 commit into
loro-dev:mainfrom
petralithic:pr/bounded-protocol-codec-20261110

Conversation

@petralithic

Copy link
Copy Markdown

DocUpdate and ELO counts were used as vector capacities before checking whether the input could contain that many entries. Tiny malformed inputs could panic with capacity overflow, and ULEB128 accepted a tenth-byte payload above the u64 range.

Bound count reservations by remaining input bytes, reject ULEB128 overflow, and precompute the encoder's output size. Reject output above 256 KiB before writing payload bytes and allocate the output once. Preserve wire fixtures, field inclusion and existing error precedence.

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