Skip to content

bug(cursor): reject overflowing terminating uint32 varints #748

Closed

Description

@outlier27-cell

Problem

Cursor's vendored protobuf Reader.uint32() accepts an overflowing five-byte varint when its fifth terminating byte carries bits above the low four permitted bits. For example, 80 80 80 80 7f terminates at byte five and is silently returned as 0xf0000000, even though the encoded value exceeds 32 bits.

Minimal reproduction

Decode a uint32 protobuf field encoded as 08 80 80 80 80 7f. The current decoder returns a truncated value instead of rejecting the malformed field.

Expected behavior

The fifth byte of a terminating uint32 varint must be at most 0x0f; larger values must fail rather than silently wrap.

Proposed scope

Validate the fifth byte before applying the final shift and add a regression for both the largest valid five-byte value and the overflowing terminator.

Activity

  1. outlier27-cell commented on Oct 11, 2026

    @outlier27-cell
    ContributorAuthor

    I am claiming this parser-boundary defect. I verified no duplicate Issue or implementation PR, and will add valid-max plus overflowing-terminator regression coverage before opening a focused fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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