From 88eb982301c6011e8bec1ab976e4be0f6c000cf8 Mon Sep 17 00:00:00 2001 From: Ennui Langeweile <85590273+EnnuiL@users.noreply.github.com> Date: Thu, 14 Nov 2024 21:08:03 -0300 Subject: [PATCH] Fix critical flaw nuking quote escaping --- .../src/main/java/org/quiltmc/parsers/json/JsonWriter.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/json/src/main/java/org/quiltmc/parsers/json/JsonWriter.java b/json/src/main/java/org/quiltmc/parsers/json/JsonWriter.java index f203c89..1ab169f 100644 --- a/json/src/main/java/org/quiltmc/parsers/json/JsonWriter.java +++ b/json/src/main/java/org/quiltmc/parsers/json/JsonWriter.java @@ -694,10 +694,6 @@ private void string(String value, boolean quotes, boolean escapeQuotes) throws I out.write('\"'); } - if (!escapeQuotes) { - replacements['\"'] = null; - } - int last = 0; int length = value.length(); @@ -705,6 +701,9 @@ private void string(String value, boolean quotes, boolean escapeQuotes) throws I char c = value.charAt(i); String replacement; if (c < 128) { + if (!escapeQuotes && c == '"') { + continue; + } replacement = replacements[c]; if (replacement == null) { continue;