Skip to content

Avoid recursion on parse due possible shenanigans#88

Merged
WebReflection merged 1 commit intomainfrom
avoid-recusrion
Mar 8, 2026
Merged

Avoid recursion on parse due possible shenanigans#88
WebReflection merged 1 commit intomainfrom
avoid-recusrion

Conversation

@WebReflection
Copy link
Owner

Apparently it is possible to create very complex recursive scenarios via flatted.stringify(...) that cannot be flatted.parse(...) after because of the recursion limit (call max stack recursion) as demoed in the test/recursion.js file.

This MR goal is to mitigate such issue by overly delaying parsing in a non recursive way.

Please Note

  • performance might be slightly worse than before but I couldn't measure anything that made me too worry about it
  • the order of the reviver callback, if any, might be slightly different now ... not sure this deserves major but in case you think it does, please let me know or it's going to be published as minor instead

That's it, that's the story.

@coveralls
Copy link

coveralls commented Mar 8, 2026

Pull Request Test Coverage Report for Build 22825027660

Details

  • 19 of 19 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 22568221797: 0.0%
Covered Lines: 132
Relevant Lines: 132

💛 - Coveralls

@WebReflection WebReflection merged commit 7eb65d8 into main Mar 8, 2026
6 checks passed
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