-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Infinite loop for illegal tokens when ignore_illegals
or highlightAuto
#2522
Comments
Oh yikes, that's quite a find. |
@wooorm Please review fix. Do you think my catch-all is overkill? I really think we've covered everything now with being/end 0 width detection plus illegal 0 width detection. Am I just being paranoid adding a third check? I just think freezes like this a VERY VERY bad things. |
Lgtm. Loop check is very heavy, but may be good indeed. Weirdly enough, this used to work in 9.16 (or at least in the lowlight clone since when it started). I’m not sure what changed: i looked a bit through git blame and the ‘m’ flag isn’t new, and I didn’t see anything else that was weird 🤷♂️ |
Heavy handed perhaps. I'm not sure it's that CPU heavy. I run a few test iterations and couldn't see a measurable difference with the typical marge of changes I usually see. Oh it could probably be faster if we just started iterations with a negative # and then compared without the multiplication... but now I think i'm micro-optimizing without a real problem. :) |
Yeah, not worth it to figure out why... something prolly changed, but 0 width matches with illegal is definitely an edge case that needs to be handled to make sure the cursor advances. |
Totes! I wasn’t worried about the performance, more code wise heavy! |
On 10.0.1, the following XML:
When passed through
highlightAuto
orhighlight
withignore_illegals
turned on, will cause an infinite loop, specifically, because of'$'
as an illegal in CSS selector attributes:highlight.js/src/languages/css.js
Line 72 in e8624cc
The text was updated successfully, but these errors were encountered: