Skip to content

fix(cursor): reject protobuf field number zero #752

Closed

Description

@outlier27-cell

Problem

The Cursor protobuf decoder accepts a field tag with field number zero when a payload follows it. 00 00 is decoded as an unknown varint field, although field number zero is forbidden by the protobuf wire format.

Reproduction

Decode a valid message schema from Uint8Array.from([0x00, 0x00]). The current decoder completes and records an unknown field instead of rejecting the invalid tag.

Expected

Reject tags whose tag >>> 3 is zero before dispatching them as known or unknown fields.

Evidence

The decoder validates wire type but does not validate the extracted field number. This is parser-boundary validation, independent of #748 and #750's varint-width bounds.

Activity

  1. outlier27-cell commented on Oct 11, 2026

    @outlier27-cell
    ContributorAuthor

    我来认领:补充 field number zero 的最小回归用例,并在通用 decoder 的 tag 校验处拒绝它。

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