From d1e7c1314164011d7c4c0baefe2b26b8fbd3d98d Mon Sep 17 00:00:00 2001 From: Joo200 Date: Mon, 11 Sep 2023 10:20:32 +0200 Subject: [PATCH] Add worldedit runtime environment to increase yaml alias limit This can be set by -Dworldedit.yaml.aliasLimit=XXX in the startup parameter --- .../src/main/java/com/sk89q/util/yaml/YAMLProcessor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java index f6d8a2c839..ee1048eb65 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java +++ b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java @@ -97,6 +97,8 @@ public YAMLProcessor(File file, boolean writeDefaults, YAMLFormat format) { representer.setDefaultFlowStyle(format.getStyle()); LoaderOptions loaderOptions = new LoaderOptions(); try { + int yamlAliasLimit = Integer.getInteger("worldedit.yaml.aliasLimit", 50); + loaderOptions.setMaxAliasesForCollections(yamlAliasLimit); // 64 MB default int yamlCodePointLimit = Integer.getInteger("worldedit.yaml.codePointLimit", 64 * 1024 * 1024); loaderOptions.setCodePointLimit(yamlCodePointLimit); @@ -104,7 +106,7 @@ public YAMLProcessor(File file, boolean writeDefaults, YAMLFormat format) { // pre-1.32 snakeyaml } - yaml = new Yaml(new SafeConstructor(new LoaderOptions()), representer, dumperOptions, loaderOptions); + yaml = new Yaml(new SafeConstructor(loaderOptions), representer, dumperOptions, loaderOptions); this.file = file; }