-
Notifications
You must be signed in to change notification settings - Fork 218
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
Fix : CSS Child Combinator Parsing Bug #297
Conversation
@@ -341,7 +341,7 @@ private static int checkHtmlCdataCloseable( | |||
} | |||
break; | |||
case '>': | |||
if (i >= 2 && sb.charAt(i - 2) == '-' && sb.charAt(i - 2) == '-') { | |||
if (i >= 2 && sb.charAt(i - 2) == '-' && sb.charAt(i - 1) == '-') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@@ -994,7 +994,7 @@ public static final void testTextareaIsNotTextArea() { | |||
assertEquals("x<textArea>y</textArea>", textAreaPolicy.sanitize(input)); | |||
} | |||
|
|||
@Test | |||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just an opportunistic fix while merging.
+ "-->\n" | ||
+ "</style>"; | ||
assertEquals(toSanitize, factory.sanitize(toSanitize)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the unit test.
@subbudvk Thanks for fixing the bug. |
241b4b8#diff-0a08f29a5b7867e56d6aa9f6abe035e32ee9411a8bc96afa9a6acff2a6d6f07fR338
The above commit was made to make parsing consistent with HTML5 Spec, but while this is being rewritten it looks like a regression was introduced when parsing for
>
To ensure this entity
>
is part of a HTML Comment it seems to have been checked the previous two characters are-
but with this commit onlychar - 2
is checked twice. So if a CSS Child combinator with-
selector is used, it was treated was a error and as a result user CSS was badly stripped. Fixing this and adding a test for it.Fixes #251