Skip to content

mismatched quotes should not cause an infinite loop #676

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

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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