text_format: enforce recursion limit for Any bracket syntax#26196
text_format: enforce recursion limit for Any bracket syntax#261961seal wants to merge 3 commits intoprotocolbuffers:mainfrom
Conversation
esrauchg
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
src/google/protobuf/text_format.cc
Outdated
| initial_recursion_limit_, ".")); | ||
| return false; | ||
| } | ||
| const bool any_ok = ConsumeAnyValue(value_descriptor, &serialized_value); |
There was a problem hiding this comment.
You can leave this as DO() and not interweave the return and recursion limit reset.
I can see its the preexisting pattern we don't restore the recursion limit in ConsumeFieldMessage() or SkipFieldMessage(), once we've failed there's not resuming and so unwinding the recursion limit isn't needed.
c49f44d to
3c4d3e7
Compare
3c4d3e7 to
d114a51
Compare
|
I'm clicking the rebase button in the github UI to unblock the cI (Writing the comment to avoid any confusion; it has surprised folks in the past that I can update their branch, its a github feature where the branch can be set to allow the upstream maintainers to make commits exactly for this reason) |
|
Unfortunately looks like the latest snapshot regressed the intended behavior (the newly added unit test now fails) |
|
i tracked the post-rebase failure down to the new test expectation rather than the recursion-limit change itself. pushed a follow-up fix adjusting the reported error location for this case. |
this makes TextFormat::Parser::SetRecursionLimit() apply to google.protobuf.Any bracket syntax ([type.googleapis.com/...]{...}) by decrementing/ restoring recursion_limit_ around ConsumeAnyValue(), matching the normal nested-message paths.\n\nadds a regression test: TextFormatParserTest.SetRecursionLimitAnyBracketSyntax.\n\nfixes: #26195