-Fixed potential inifinite loop when parsing unquoted value

-Added NuGet install.ps1
-Incremented version to 5.0.6
This commit is contained in:
James Newton-King
2013-06-01 14:18:20 +12:00
parent 1b63698c02
commit 13aa07f63e
9 changed files with 144 additions and 9 deletions
@@ -47,6 +47,32 @@ namespace Newtonsoft.Json.Tests
[TestFixture]
public class JsonTextReaderTest : TestFixtureBase
{
[Test]
public void ThrowErrorWhenParsingUnquoteStringThatStartsWithNE()
{
const string json = @"{ ""ItemName"": ""value"", ""u"":netanelsalinger,""r"":9 }";
JsonTextReader reader = new JsonTextReader(new StringReader(json));
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.StartObject, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.String, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
ExceptionAssert.Throws<JsonReaderException>("Unexpected content while parsing JSON. Path 'u', line 1, position 27.",
() =>
{
reader.Read();
});
}
[Test]
public void FloatParseHandling()
{
@@ -49,6 +49,17 @@ namespace Newtonsoft.Json.Tests.Linq
[TestFixture]
public class LinqToJsonTest : TestFixtureBase
{
[Test]
public void ForEach()
{
JArray items = new JArray(new JObject(new JProperty("name", "value!")));
foreach (JObject friend in items)
{
Console.WriteLine(friend);
}
}
[Test]
public void DoubleValue()
{
@@ -75,4 +75,4 @@ using System.Security;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.5.0.0")]
[assembly: AssemblyFileVersion("5.0.5.16124")]
[assembly: AssemblyFileVersion("5.0.6.16201")]
+4
View File
@@ -1150,6 +1150,10 @@ namespace Newtonsoft.Json
SetToken(JsonToken.StartConstructor, constructorName);
}
else
{
throw JsonReaderException.Create(this, "Unexpected content while parsing JSON.");
}
}
private void ParseNumber()
@@ -5,7 +5,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A9AE40FF-1A21-414A-9FE7-3BE13644CC6D}</ProjectGuid>
<ProjectGuid>{B70AD007-4437-44C2-A25A-6D5AE41691F9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Newtonsoft.Json</RootNamespace>
@@ -92,6 +92,6 @@ using System.Security;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.5.0.0")]
[assembly: AssemblyFileVersion("5.0.5.16124")]
[assembly: AssemblyFileVersion("5.0.6.16201")]
[assembly: CLSCompliant(true)]