Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change MaxDepth default to 64 #2473

Merged
merged 1 commit into from Feb 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
Expand Up @@ -8000,10 +8000,10 @@ public void NullableDoubleEmptyValue()
public void SetMaxDepth_DepthExceeded()
{
JsonTextReader reader = new JsonTextReader(new StringReader("[[['text']]]"));
Assert.AreEqual(128, reader.MaxDepth);
Assert.AreEqual(64, reader.MaxDepth);

JsonSerializerSettings settings = new JsonSerializerSettings();
Assert.AreEqual(128, settings.MaxDepth);
Assert.AreEqual(64, settings.MaxDepth);
Assert.AreEqual(false, settings._maxDepthSet);

// Default should be the same
Expand Down Expand Up @@ -8034,7 +8034,7 @@ public void SetMaxDepth_DepthNotExceeded()

serializer.Deserialize(reader);

Assert.AreEqual(128, reader.MaxDepth);
Assert.AreEqual(64, reader.MaxDepth);
}
}
}
2 changes: 1 addition & 1 deletion Src/Newtonsoft.Json/JsonReader.cs
Expand Up @@ -329,7 +329,7 @@ protected JsonReader()
_dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;
_dateParseHandling = DateParseHandling.DateTime;
_floatParseHandling = FloatParseHandling.Double;
_maxDepth = 128;
_maxDepth = 64;

CloseInput = true;
}
Expand Down
2 changes: 1 addition & 1 deletion Src/Newtonsoft.Json/JsonSerializerSettings.cs
Expand Up @@ -61,7 +61,7 @@ public class JsonSerializerSettings
internal static readonly CultureInfo DefaultCulture;
internal const bool DefaultCheckAdditionalContent = false;
internal const string DefaultDateFormatString = @"yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
internal const int DefaultMaxDepth = 128;
internal const int DefaultMaxDepth = 64;

internal Formatting? _formatting;
internal DateFormatHandling? _dateFormatHandling;
Expand Down