* Catch excessive objects in json being parsed, even if following a comment. * Include line info on excessive content for deserialisation.
This commit is contained in:
committed by
James Newton-King
parent
76600dcc5b
commit
8956d3ca9c
@@ -2187,11 +2187,12 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
JToken t = Load(reader, settings);
|
||||
|
||||
if (reader.Read() && reader.TokenType != JsonToken.Comment)
|
||||
while (reader.Read())
|
||||
{
|
||||
throw JsonReaderException.Create(reader, "Additional text found in JSON string after parsing content.");
|
||||
// Any content encountered here other than a comment will throw in the reader.
|
||||
}
|
||||
|
||||
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user