Skip to content

Conversation

@wwbmmm
Copy link
Contributor

@wwbmmm wwbmmm commented Sep 20, 2025

What problem does this PR solve?

Issue Number: NULL

Problem Summary: Add pb2json depth limit

What is changed and the side effects?

Changed: Add recursion depth limit for ProtoMessageToJson, ProtoMessageToProtoJson, JsonToProtoMessage, ProtoJsonToProtoMessage

Side effects:

  • Performance effects: Slightly cost more CPU in the pb2json and json2pb functions

  • Breaking backward compatibility: pb message or json with a depth > 100 will convert fail. User can increase the gflag json2pb_max_recursion_depth to handle larger depth.


Check List:

@wwbmmm wwbmmm requested a review from Copilot September 20, 2025 09:37
@apache apache deleted a comment from Copilot AI Sep 20, 2025
@apache apache deleted a comment from Copilot AI Sep 20, 2025
@apache apache deleted a comment from Copilot AI Sep 20, 2025
@apache apache deleted a comment from Copilot AI Sep 20, 2025
@apache apache deleted a comment from Copilot AI Sep 20, 2025

This comment was marked as resolved.

@chenBright chenBright requested a review from Copilot September 22, 2025 02:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@chenBright chenBright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wwbmmm wwbmmm merged commit 49c3e4d into apache:master Sep 24, 2025
16 checks passed
chenBright pushed a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Add pb2json depth limit

* fix multi json test case failed

* define DEEP_RECURSION_TEST_DEPTH constant

* Remove duplicate root_msg and root_val param
chenBright pushed a commit to chenBright/brpc that referenced this pull request Sep 28, 2025
* Add pb2json depth limit

* fix multi json test case failed

* define DEEP_RECURSION_TEST_DEPTH constant

* Remove duplicate root_msg and root_val param
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.

2 participants