Skip to content

Commit

Permalink
Merge pull request #676 from dubinsky/mismatched-quotes-infinite-loop
Browse files Browse the repository at this point in the history
mismatched quotes should not cause an infinite loop
  • Loading branch information
dubinsky authored Jun 22, 2023
2 parents 7aebf85 + 671428d commit c1d49c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,10 @@ class ConstructingParserTest {
val parser: ConstructingParser = ConstructingParser.fromSource(Source.fromString(xml), preserveWS = true)
parser.document().docElem // shouldn't crash
}

@Test(expected = classOf[scala.xml.parsing.FatalError])
def issue656(): Unit = {
// mismatched quotes should not cause an infinite loop
XhtmlParser(Source.fromString("""<html><body myAttribute='value"/></html>"""))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private[scala] trait MarkupParserCommon extends TokenTests {
val buf: StringBuilder = new StringBuilder
while (ch != endCh && !eof) {
// well-formedness constraint
if (ch == '<') reportSyntaxError("'<' not allowed in attrib value")
if (ch == '<') truncatedError("'<' not allowed in attrib value")
else if (ch == SU) truncatedError("")
else buf.append(ch_returning_nextch)
}
Expand Down

0 comments on commit c1d49c8

Please sign in to comment.