Skip to content

Reject overlong varints to avoid stream desync #75

@peter-jerry-ye

Description

@peter-jerry-ye

In read_varint32/read_varint64 (and async variants), the decoder returns after 5/10 bytes even if the continuation bit is still set. This accepts overlong varints and leaves extra continuation bytes in the stream, which then desyncs subsequent field decoding.

Suggested fix: detect overlong varints and raise an error if the continuation bit is still set after the max length. Also mirror the change in async paths.

Refs: lib/reader.mbt, lib/async_reader.mbt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions