scala-xml icon indicating copy to clipboard operation
scala-xml copied to clipboard

Infinite loop caused by unclosed character ref in MarkupParser#content

Open aldiyen opened this issue 5 years ago • 2 comments

Putting an unclosed character ref (&#) in XML causes an infinite loop. Example code:

import scala.io.Source
import scala.xml.parsing.XhtmlParser
val text = "<html><body>test &# test </body></html>"
XhtmlParser(Source.fromString(text))

aldiyen avatar Apr 29 '19 22:04 aldiyen

Thanks for reporting this. I'm seeing this in version 1.2.0 and as far back as 1.0.6. Some of this code was recently changed to fix similar defects in 1.1.1. I thought this might be a regression in the 1.1.1 changes, but it appears not.

ashawley avatar Apr 29 '19 22:04 ashawley

This in XML is also causing an infinite loop:

myAttribute=`value"

Note that the quotes are mis-matched.

mbeckerle avatar Jul 29 '22 17:07 mbeckerle