Skip to content

Support StreamReadConstraints.maxDocumentLength in ProtobufParser - #784

Open
pjfanning wants to merge 1 commit into
FasterXML:3.xfrom
pjfanning:protobuf-max-doc-len
Open

Support StreamReadConstraints.maxDocumentLength in ProtobufParser#784
pjfanning wants to merge 1 commit into
FasterXML:3.xfrom
pjfanning:protobuf-max-doc-len

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Fixes #783.

ProtobufParser ignored StreamReadConstraints.maxDocumentLength. This adds the same checks CBOR and Smile have:

  • loadMore() / _loadToHaveAtLeast(): validateDocumentLength(_currInputProcessed) after advancing the processed-bytes counter (streaming input)
  • ProtobufFactory._createParser(..., byte[], int, int): validateDocumentLength(len) up front (fixed-buffer input, as per [core#1548])

Adds dos/LongDocumentProtobufReadTest covering both input modes, plus an unconstrained control. Verified the test fails without the parser/factory change.

🤖 Generated with Claude Code

…sterXML#783)

Validate document length when reloading the input buffer for streaming
input (loadMore() / _loadToHaveAtLeast()), and up front for fixed byte[]
input in ProtobufFactory, matching what CBOR and Smile already do.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

(protobuf) Support StreamReadConstraints.maxDocumentLength in ProtobufParser

1 participant