Skip to content

c++ text_format: Any bracket syntax bypasses TextFormat::Parser recursion limit #26195

@1seal

Description

@1seal

when parsing text format, TextFormat::Parser::SetRecursionLimit() is enforced for normal nested message parsing, but not for the google.protobuf.Any bracket syntax ([type.googleapis.com/...]{...}).\n\nthis means attacker-controlled textproto can exceed the configured recursion limit by nesting Any inside Any via bracket syntax, potentially leading to deep recursion / stack exhaustion for deployments that parse untrusted textproto and rely on SetRecursionLimit as a guardrail.\n\ncallsite: src/google/protobuf/text_format.cc (ParserImpl::ConsumeField)\n\nproposed fix: decrement/restore recursion_limit_ around ConsumeAnyValue() in the Any bracket syntax path, matching ConsumeFieldMessage()/SkipFieldMessage().\n\nPR: #26196

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