Repository navigation
Return an error for deeply nested expressions in proto conversion - #11558
Open
Bhup-GitHUB wants to merge 2 commits into
Open
Bhup-GitHUB wants to merge 2 commits into
Bhup-GitHUB wants to merge 2 commits into
Conversation
serialize_proto and from_proto recursed once per nesting level with no limit, so a deeply nested expression overflowed the stack and aborted the process. Both directions now return an error past MAX_EXPR_PROTO_DEPTH (100), which stays within prost's default decode recursion limit. Signed-off-by: Bhupesh Kumar <145711585+Bhup-GitHUB@users.noreply.github.com>
Check the limit boundary for serialize_proto, from_proto and the encoded decode path, and that a 10,000-deep expression errors instead of overflowing the stack. Signed-off-by: Bhupesh Kumar <145711585+Bhup-GitHUB@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11424
serialize_protoandExpression::from_protorecursed once per nesting level with no bound. A deeply nested expression, for example thousands of foldednotorandnodes, overflowed the stack and aborted the process instead of returning an error. Decoding from bytes was only bounded by prost's default recursion limit, which does not apply to apb::Exprbuilt in memory or to serialization.Both directions now share one depth check and return the same error past the new public
MAX_EXPR_PROTO_DEPTH, which callers that buildpb::Exprby hand can check against. The limit is 100 levels, counting the root expression as one, which stays within prost's default decode recursion limit, so any expression Vortex serializes can also be decoded. Tests cover the limit boundary in both directions, the encoded decode path, and a 10,000-deep expression that now errors instead of overflowing.Before:
After:
This PR was prepared with AI assistance; I reviewed the change and ran the tests.