From: SourceForge.net <no...@so...> - 2012-08-29 18:58:38
|
Bugs item #3555034, was opened at 2012-08-07 01:47 Message generated for change (Comment added) made by rbri You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=952178&aid=3555034&group_id=195122 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: tag-balancer Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Luc Claes (lucclaes) Assigned to: Nobody/Anonymous (nobody) Summary: StackOverflowError in HTMLTagBalancer Initial Comment: The attached file causes a StackOverflowError. Agreed, it is very badly formatted but it is a 'real life' case... Tested with version 1.9.16 HTMLTagBalancer.endElement(QName, Augmentations) line: 1015 ---------------------------------------------------------------------- Comment By: RBRi (rbri) Date: 2012-08-29 11:58 Message: Hi Marc, i have no chance to add an patch... Why? Index: data/regression/test-3555034.html =================================================================== --- data/regression/test-3555034.html (revision 0) +++ data/regression/test-3555034.html (working copy) @@ -0,0 +1,7 @@ + +<frameset> + <p></p> +</frameset> + + +<p></p> Index: data/regression/test-3555034.html.canonical =================================================================== --- data/regression/test-3555034.html.canonical (revision 0) +++ data/regression/test-3555034.html.canonical (working copy) @@ -0,0 +1,12 @@ +(HTML +(FRAMESET +"\n +(HEAD +)HEAD +(BODY +(P +)P +"\n +)BODY +)FRAMESET +)HTML Index: src/org/cyberneko/html/HTMLTagBalancer.java =================================================================== --- src/org/cyberneko/html/HTMLTagBalancer.java (revision 306) +++ src/org/cyberneko/html/HTMLTagBalancer.java (working copy) @@ -1011,8 +1011,9 @@ int depth = getElementDepth(elem); if (depth == -1) { if (elem.code == HTMLElements.P) { - forceStartElement(element, emptyAttributes(), synthesizedAugs()); - endElement(element, augs); + if (forceStartElement(element, emptyAttributes(), synthesizedAugs())) { + endElement(element, augs); + } } else if (!elem.isEmpty()) { notifyDiscardedEndElement(element, augs); @@ -1045,7 +1046,7 @@ fErrorReporter.reportWarning("HTML2007", new Object[]{ename,iname}); } if (fDocumentHandler != null) { - // PATCH: Marc-Andr� Morissette + // PATCH: Marc-Andr� Morissette callEndElement(info.qname, i < depth - 1 ? synthesizedAugs() : augs); } } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=952178&aid=3555034&group_id=195122 |