Merge pull request #287 from blowdart/master

Limited integer parsing to javascript integer size.
This commit is contained in:
James Newton-King
2014-06-14 19:08:18 +12:00
2 changed files with 18 additions and 0 deletions
@@ -995,6 +995,18 @@ now brown cow?", '"', true);
Assert.AreEqual("Bad Boys", m.Name);
}
[Test]
public void IntegerLengthOverflows()
{
// Maximum javascript number length (in characters) is 380
dynamic d = JObject.Parse(@"{""biginteger"":" + new String('9', 380) + "}");
ExceptionAssert.Throws<JsonReaderException>(
"JSON integer " + new String('9', 381) + " is too large to parse. Path 'biginteger', line 1, position 395.",
() => JObject.Parse(@"{""biginteger"":" + new String('9', 381) + "}"));
}
//[Test]
public void StackOverflowTest()
{