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

Fix infinite loop caused by unclosed character ref #651

Merged
merged 2 commits into from
Mar 27, 2023

Conversation

mike-mcgann
Copy link
Contributor

Resolves #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.

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.
Copy link
Contributor

@dubinsky dubinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this merges, #306 will close; there is a comment there about a different infinite loop - would you mind extracting it into a separate issue so that it is not lost? Thank you!

@@ -219,4 +219,15 @@ class UtilityTest {
val x: Elem = <div>{Text(" My name ")}{Text(" is ")}{Text(" Harry ")}</div>
assertEquals(<div>My name is Harry</div>, Utility.trim(x))
}

@Test
def issue306InvalidUnclosedEntity(): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the name of the test method should be more specific: this is about character references, not entities in general...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing that. I have updated the test method to use CharRef instead. I also created ticket #656 for the other infinite loop issue.

Copy link
Contributor

@dubinsky dubinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!!

@dubinsky dubinsky merged commit ee8ae94 into scala:main Mar 27, 2023
srowen pushed a commit to apache/spark that referenced this pull request Jul 27, 2023
### What changes were proposed in this pull request?
This pr aims to upgrade `scala-xml` from 2.1.0 to 2.2.0.

### Why are the changes needed?
The new version bring some bug fix like:
- scala/scala-xml#651
- scala/scala-xml#677

The full release notes as follows:
- https://github.com/scala/scala-xml/releases/tag/v2.2.0

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
- Pass GitHub Actions
- Checked Scala 2.13, all Scala test passed: https://github.com/LuciferYang/spark/runs/15278359785

Closes #42119 from LuciferYang/scala-xml-220.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
ragnarok56 pushed a commit to ragnarok56/spark that referenced this pull request Mar 2, 2024
### What changes were proposed in this pull request?
This pr aims to upgrade `scala-xml` from 2.1.0 to 2.2.0.

### Why are the changes needed?
The new version bring some bug fix like:
- scala/scala-xml#651
- scala/scala-xml#677

The full release notes as follows:
- https://github.com/scala/scala-xml/releases/tag/v2.2.0

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
- Pass GitHub Actions
- Checked Scala 2.13, all Scala test passed: https://github.com/LuciferYang/spark/runs/15278359785

Closes apache#42119 from LuciferYang/scala-xml-220.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite loop caused by unclosed character ref in MarkupParser#content
2 participants