de-jcup / eclipse-yaml-editor

Eclipse YAML editor
https://marketplace.eclipse.org/content/yaml-editor
Apache License 2.0
35 stars 10 forks source link

recursice anchors cause stackoverflow exception #93

Closed elonderin closed 3 years ago

elonderin commented 4 years ago

in my gitlab yaml i did this accidentally:

.env-vars: &env-vars
  - 'echo -e "section_start:`date +%s`:envvars\r\e[0Kenvvars" '
  - *env-vars
  - 'echo -e "section_end:`date +%s`:envvars\r\e[0Kenvvars" '

and when opening the quick outline i got a famous:

java.lang.StackOverflowError
    at de.jcup.yamleditor.script.YamlScriptModelBuilder.appendSequence(YamlScriptModelBuilder.java:162)
    at de.jcup.yamleditor.script.YamlScriptModelBuilder.buildNode(YamlScriptModelBuilder.java:107)
    at de.jcup.yamleditor.script.YamlScriptModelBuilder.createYamlNodeAndAddToParent(YamlScriptModelBuilder.java:185)
    at de.jcup.yamleditor.script.YamlScriptModelBuilder.appendSequence(YamlScriptModelBuilder.java:162)
...

note: when re-opening the editor the outline view is empty

de-jcup commented 4 years ago

Yes, was able to reproduce this problem/bug. Thanks for reporting.

de-jcup commented 3 years ago

A good example for anchors and aliases in yaml can be found at https://medium.com/@kinghuang/docker-compose-anchors-aliases-extensions-a1e4105d70bd