config icon indicating copy to clipboard operation
config copied to clipboard

StackOverflowError when using the concatenation operator

Open laurentgo opened this issue 3 years ago • 3 comments

It is possible to easily trigger a StackOverflowError during resolution if using the concatenation operator a large number of times.

For example the following test case is likely to fail with the exception:

  val config = (1 to 1000).map { i => s"a += $i" }.mkString("\n")
  val values = ConfigFactory.parseString(config).resolve()
  assertEquals("lists did not merge", Seq.range(1, 1001), values.getIntList("a").asScala

(Note that it would fail too with a lower number of concatenations if substitution tracing was enabled)

laurentgo avatar Apr 22 '21 21:04 laurentgo

I have to increase JVM stack size to 4 MB as a workaround. Substitutions should not be parsed recursively.

aalleexxeeii avatar Oct 26 '21 15:10 aalleexxeeii

This is still a huge issue for me. @havocp, do you think it can be easily fixed?

aalleexxeeii avatar Jul 11 '22 14:07 aalleexxeeii

No idea, I haven't looked...

havocp avatar Jul 11 '22 14:07 havocp