You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Pedro Santos (JIRA)" <ji...@apache.org> on 2011/03/04 03:29:36 UTC

[jira] Updated: (WICKET-3500) Method AbstractMarkupParser.removeComment() causes an endless loop

     [ https://issues.apache.org/jira/browse/WICKET-3500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pedro Santos updated WICKET-3500:
---------------------------------

    Attachment: WICKET-3500.patch

Avoiding endless loop by throwing an exception, since the parser is failing due an unclosed comment tag

> Method AbstractMarkupParser.removeComment() causes an endless loop
> ------------------------------------------------------------------
>
>                 Key: WICKET-3500
>                 URL: https://issues.apache.org/jira/browse/WICKET-3500
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.4.16
>            Reporter: Georg Juttner
>         Attachments: WICKET-3500.patch
>
>
> The last change (see WICKET-3277) of method AbstractMarkupParser.removeComment() in Wicket 1.4.16 causes an endless loop if the markup contains conditional comments for IE. 
> For example, the following string causes a loop in method removeComment()
> rawMarkup = "\r\n      <!--[if IE 6]>\r\n        "
> According to the following code snippet 
> 	private String removeComment(String rawMarkup)
> 	{
> 		int pos1 = rawMarkup.indexOf("<!--");
> 		while (pos1 != -1)
> 		{
> 			int pos2 = rawMarkup.indexOf("-->", pos1 + 4);
> 			final StringBuilder buf = new StringBuilder(rawMarkup.length());
> 			if (pos2 != -1)
> 			{
> 			...
> 			}
> 			pos1 = rawMarkup.indexOf("<!--", pos1);
> 		}
> 		return rawMarkup;
> 	}
> one can see that pos1 remains unchanged if pos2 == -1.
> The previous version in Wicket 1.4.15 doesn't have this defect. As a workaround set StripComments to false.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira