Skip to content

OutOfMemoryErrors and inifinte loops in scala.xml.parsing.ConstructingParser #4520

Closed
@scabug

Description

@scabug

=== What steps will reproduce the problem? ===

val x = xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<foo/>"), false)

x.xCharData
:1:1: '[' expected instead of _^
:1:1: 'C' expected instead of _^
:1:1: 'D' expected instead of _^
:1:1: 'A' expected instead of _^
:1:1: 'T' expected instead of _^
:1:1: 'A' expected instead of _^
:1:1: '[' expected instead of _^
java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:2894)
	at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:117)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:589)
	at java.lang.StringBuilder.append(StringBuilder.java:220)
	at scala.collection.mutable.StringBuilder.append(StringBuilder.scala:252)
	at scala.xml.parsing.MarkupParserCommon$$class.xTakeUntil(MarkupParserCommon.scala:243)
	at scala.xml.parsing.ConstructingParser.xTakeUntil(ConstructingParser.scala:47)
	at scala.xml.parsing.MarkupParser$$class.xCharData(MarkupParser.scala:349)
	at scala.xml.parsing.ConstructingParser.xCharData(ConstructingParser.scala:47)

x.xCharRef
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^

:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref
^
:1:1: character _ not allowed in char ref


x.xComment
:1:1: '-' expected instead of '<'foo/>^
:1:1: '-' expected instead of '<'^
java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:2894)
	at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:117)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:589)
	at java.lang.StringBuilder.append(StringBuilder.java:220)
	at scala.collection.mutable.StringBuilder.append(StringBuilder.scala:252)
	at scala.xml.parsing.MarkupParser$$class.xComment(MarkupParser.scala:365)
	at scala.xml.parsing.ConstructingParser.xComment(ConstructingParser.scala:47)

=== What is the expected behavior? ===
It should do something sensible.

=== What do you see instead? ===
xCharData, xComment: java.lang.OutOfMemoryError: Java heap space
xCharRef: Just loops.

=== What versions of the following are you using? ===

  • Scala: 2.10.0.r24736-b20110412020139

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions