Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate against infinite loop in ListItemNode.setIndent #4120

Merged
merged 1 commit into from
Mar 16, 2023
Merged

Conversation

acywatson
Copy link
Contributor

@acywatson acywatson commented Mar 14, 2023

This one is a bit interesting. We had a couple of issues here.

First, we shouldn't have been using ListItemNode.setIndent in the deserialization logic for this node, as it runs a bunch of node manipulation logic that shouldn't be necessary in that code path.

Second, if you call ListItemNode.setIndent directly and you're not using a compile-time type-checker, then you can cause an infinite loop here. It's a bit of a footgun lying around.

On the other hand, you could probably cause all sorts of weird issues by passing invalid data types into node setters across the library. I'm addressing this because it seems like particularly gnarly one, but taking this to it's logic conclusion means we'd do this everywhere, which I'm not sure is practically necessary.

Fixes #4119

@vercel
Copy link

vercel bot commented Mar 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
lexical ✅ Ready (Inspect) Visit Preview Mar 14, 2023 at 7:08AM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview Mar 14, 2023 at 7:08AM (UTC)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 14, 2023
@github-actions
Copy link

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 26.85 KB (0%) 538 ms (0%) 123 ms (+7.39% 🔺) 660 ms
packages/lexical-rich-text/dist/LexicalRichText.js 37.69 KB (0%) 754 ms (0%) 194 ms (-12.29% 🔽) 948 ms
packages/lexical-plain-text/dist/LexicalPlainText.js 37.66 KB (0%) 754 ms (0%) 145 ms (+77.4% 🔺) 898 ms

@Alex-Github-Account Alex-Github-Account mentioned this pull request Mar 14, 2023
@zurfyx zurfyx merged commit 5445f2c into main Mar 16, 2023
@zurfyx zurfyx mentioned this pull request Mar 24, 2023
@fantactuka fantactuka deleted the fix-loop branch July 6, 2023 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug:
4 participants