From 6071a71e3c581fbb5f405002399a0eb4817f23de Mon Sep 17 00:00:00 2001 From: Ilpo Ruotsalainen Date: Wed, 31 Jul 2024 17:51:36 -0700 Subject: [PATCH] Fix two bugs in VDF parsing of KVDict entries. Empty KVDict would cause the parser to crash due whitespaces not being consumed correctly, and a missing consume of the closing brace would result in premature stopping of parsing when a KVDict is inside another KVDict. --- client-gui/VDFSerializer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client-gui/VDFSerializer.cs b/client-gui/VDFSerializer.cs index 5e681b6..c013caf 100644 --- a/client-gui/VDFSerializer.cs +++ b/client-gui/VDFSerializer.cs @@ -35,6 +35,7 @@ private static char PossiblyQuotedChar(TextReader reader) { private static Dictionary KVDict(TextReader reader) { var dict = new Dictionary(); Consume('{', reader); + SkipWhitespace(reader); while (reader.Peek() != '}') { SkipWhitespace(reader); var key = QuotedString(reader); @@ -42,6 +43,7 @@ private static Dictionary KVDict(TextReader reader) { dict.Add(key, value); SkipWhitespace(reader); } + Consume('}', reader); return dict; }