Skip to content

Commit c1d49c8

Browse files
authored
Merge pull request #676 from dubinsky/mismatched-quotes-infinite-loop
mismatched quotes should not cause an infinite loop
2 parents 7aebf85 + 671428d commit c1d49c8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala

+6
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,10 @@ class ConstructingParserTest {
9191
val parser: ConstructingParser = ConstructingParser.fromSource(Source.fromString(xml), preserveWS = true)
9292
parser.document().docElem // shouldn't crash
9393
}
94+
95+
@Test(expected = classOf[scala.xml.parsing.FatalError])
96+
def issue656(): Unit = {
97+
// mismatched quotes should not cause an infinite loop
98+
XhtmlParser(Source.fromString("""<html><body myAttribute='value"/></html>"""))
99+
}
94100
}

shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private[scala] trait MarkupParserCommon extends TokenTests {
6767
val buf: StringBuilder = new StringBuilder
6868
while (ch != endCh && !eof) {
6969
// well-formedness constraint
70-
if (ch == '<') reportSyntaxError("'<' not allowed in attrib value")
70+
if (ch == '<') truncatedError("'<' not allowed in attrib value")
7171
else if (ch == SU) truncatedError("")
7272
else buf.append(ch_returning_nextch)
7373
}

0 commit comments

Comments
 (0)