-
Notifications
You must be signed in to change notification settings - Fork 112
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
badTags tagStripper can suffer catastrophic backtracking #111
Comments
My quick solution is to check for any closing tag first:
However I imagine that there is some modification to the RegExp that can fix the problem. |
Can you give an example that would "backtrack catastrophically" and the configuration you are currently using? |
Do you think this issue might have something to do with this: summernote/summernote#4472 |
I don't think it's related to that issue. Here is an example of catastrophic backtracking, using the tag The content consists of just one |
@alexmdavis sorry didn't see the notification for the reply. That is the regex, but I'm curious as to the configuration you have as I have seen this code parse far bigger texts than this and with other single tags such as It would help myself debug this if I could get the plugin configuration (I can use what you put in the regex as a test for this issue). Many thanks for you help so far. |
@RichardSquires this is one config that reproduces the problem (with
|
Should you be using meta within content markup? Keep in mind Summernote is primarily concerned with editing content that is visual, i.e. content that doesn't use elements normally used for page layout, head areas, or script elements. Meta tags shouldn't really be used within editable content areas. Do you really mean the issue occurs where elements don't use a closing element or ending |
Yes, perhaps I have been too specific to one example. It appears to happen with any tag that doesn't have a closing element or |
Well, that makes sense then, and more importantly |
@alexmdavis Can you shed some light on why keepTagsContents is set to ['html', 'body'] instead of []? |
The tagStripper RegExp for badTags can backtrack catastrophically if the content is very large, and if no closing tag exists (such as a
meta
tag). https://github.com/DiemenDesign/summernote-cleaner/blob/ee248b92f047bdcfb30007b31a047d78253ae814/summernote-cleaner.js#L217-L218The text was updated successfully, but these errors were encountered: