Skip to content
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

Infinite loop caused by unclosed character ref in MarkupParser#content #306

Closed
aldiyen opened this issue Apr 29, 2019 · 2 comments · Fixed by #651
Closed

Infinite loop caused by unclosed character ref in MarkupParser#content #306

aldiyen opened this issue Apr 29, 2019 · 2 comments · Fixed by #651

Comments

@aldiyen
Copy link

aldiyen commented Apr 29, 2019

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))
@ashawley
Copy link
Member

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.

@mbeckerle
Copy link

This in XML is also causing an infinite loop:

myAttribute=`value"

Note that the quotes are mis-matched.

mike-mcgann added a commit to mike-mcgann/scala-xml that referenced this issue Mar 15, 2023
Resolves scala#306

If parseCharRef is called for an unclosed character reference it will
get caught in an infinite loop if the end of file is reached. Add a
check to exit the loop when an EOF is encountered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants