Repository navigation
Conversation
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.
Fixes #5653
It changes the following:
depth.jswhich covers test regarding stack-overflow.Extras added to the codebase:
MAX_CLONE_DEPTHvariable which basically tracks the upper bound of stack and prevents overflowing.depth_limit_exceeded()which returns error if the object is deeply nested using the samejs_error!convention asunsupported_type()How it works:
->
boa/core/wintertc/src/store/from.rs(serialization)SeenMapnow maintains adepthcounter along with the existing address map.try_from_js_valuechecks whether the depth limit has been reached. If not, it increments the counter, calls the renamedtry_from_js_value_inner, and then decrements the counter after the operation finishes, even if an error occurs.try_from_js_value. This means a single check at this function controls the recursion depth for the entire serialization process.->
boa/core/wintertc/src/store/to.rs(deserialization)ReverseSeenMapnow also maintains adepthcounter.try_value_into_jsfollows the same approach: it checks the depth limit, increments the counter, callstry_value_into_js_inner, and then decrements the counter, including when an error occurs.->
boa/core/runtime/tests/clone/depth.js(new regression test)