Skip to content

Commit

Permalink
Merge pull request #701 from lightbend/fix-stack-overflow-in-resolve-…
Browse files Browse the repository at this point in the history
…context

Remove unmodifiable collection wrappers in ResolveContext
  • Loading branch information
havocp authored Sep 18, 2020
2 parents e0984d4 + 4739cba commit 001e6c3
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ final class ResolveContext {
this.memos = memos;
this.options = options;
this.restrictToChild = restrictToChild;
this.resolveStack = Collections.unmodifiableList(resolveStack);
this.cycleMarkers = Collections.unmodifiableSet(cycleMarkers);
// we don't defensively copy/wrap these because Collections.unmodifiableList etc.
// nest infinitely in a way that causes stack overflow (they don't check to avoid
// multiple wrappers). But they should be treated as immutable because they end
// up shared between multiple ResolveContext.
this.resolveStack = resolveStack;
this.cycleMarkers = cycleMarkers;
}

private static Set<AbstractConfigValue> newCycleMarkers() {
Expand Down

0 comments on commit 001e6c3

Please sign in to comment.