Skip to content

Add recursion depth check for TYPE_GROUP in UntypedMessage::Decode()#26467

Open
lonelybones wants to merge 2 commits intoprotocolbuffers:mainfrom
lonelybones:fix-group-recursion-depth
Open

Add recursion depth check for TYPE_GROUP in UntypedMessage::Decode()#26467
lonelybones wants to merge 2 commits intoprotocolbuffers:mainfrom
lonelybones:fix-group-recursion-depth

Conversation

@lonelybones
Copy link
Copy Markdown

UntypedMessage::Decode() in the BinaryToJson code path was missing a call to stream.IncrementRecursionDepth() for WIRETYPE_START_GROUP, allowing unbounded stack recursion via deeply nested groups. The parallel handler for TYPE_MESSAGE in DecodeDelimited() already had this check.

This is the same class of issue as CVE-2024-7254 (protobuf-java).

Fixes https://issuetracker.google.com/issues/493306525

@esrauchg esrauchg added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Mar 25, 2026
@github-actions github-actions Bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Mar 25, 2026
@karenwuz karenwuz added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Apr 3, 2026
@github-actions github-actions Bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Apr 3, 2026
@lonelybones lonelybones force-pushed the fix-group-recursion-depth branch from 958c2e6 to 0978b44 Compare April 3, 2026 18:21
UntypedMessage::Decode() in the BinaryToJson code path was missing a call
to stream.IncrementRecursionDepth() for WIRETYPE_START_GROUP, allowing
unbounded stack recursion via deeply nested groups. The parallel handler
for TYPE_MESSAGE in DecodeDelimited() already had this check.

This is the same class of issue as CVE-2024-7254 (protobuf-java).

Fixes https://issuetracker.google.com/issues/493306525
@lonelybones lonelybones force-pushed the fix-group-recursion-depth branch from 0978b44 to 112e529 Compare April 3, 2026 18:26
@karenwuz karenwuz added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Apr 7, 2026
@github-actions github-actions Bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Apr 7, 2026
@karenwuz
Copy link
Copy Markdown
Contributor

karenwuz commented Apr 7, 2026

@lonelybones looks like there are failing tests. Please fix.

@lonelybones lonelybones force-pushed the fix-group-recursion-depth branch from 112e529 to efb178f Compare April 7, 2026 19:41
@lonelybones
Copy link
Copy Markdown
Author

Fixed. Removed the incorrect Bazel dep, built and tested locally with 'bazel test //src/google/protobuf/json:json_test' before pushing.

@karenwuz karenwuz added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Apr 7, 2026
@github-actions github-actions Bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Apr 7, 2026
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.

3 participants