diff options
author | Jussi Sainio <jussi.sainio@iki.fi> | 2014-06-06 16:54:21 +0400 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2016-04-01 15:10:33 +0300 |
commit | 5c8d6e96c1efc7684f5582ed607858d869625bfb (patch) | |
tree | 40f11efa36da77b49b30cde25edae8f12755a345 | |
parent | a7fb596803dad69b8c371e581203b66425656f28 (diff) |
[System.Web.Extensions] Use CultureInfo.InvariantCulture for number parsing
Fixes #4242, see bug comments. JsonSerializer seems to have been already
fixed in abe9dc62. The JsonDeserializer number conversion is now much
stricter, allowing only integer number style for integers and float number
style for floats.
-rw-r--r-- | mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonDeserializer.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonDeserializer.cs b/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonDeserializer.cs index 891b1ef66ce..29e6cfb92b8 100644 --- a/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonDeserializer.cs +++ b/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonDeserializer.cs @@ -473,22 +473,22 @@ namespace System.Web.Script.Serialization case JsonType.INTEGER: /* MS AJAX.NET JSON parser promotes big integers to double */ - if (Int32.TryParse (s, out intValue)) + if (Int32.TryParse (s, NumberStyles.Integer, CultureInfo.InvariantCulture, out intValue)) result = intValue; - else if (Int64.TryParse (s, out longValue)) + else if (Int64.TryParse (s, NumberStyles.Integer, CultureInfo.InvariantCulture, out longValue)) result = longValue; - else if (Decimal.TryParse (s, out decimalValue)) + else if (Decimal.TryParse (s, NumberStyles.Integer, CultureInfo.InvariantCulture, out decimalValue)) result = decimalValue; - else if (Double.TryParse (s, out doubleValue)) + else if (Double.TryParse (s, NumberStyles.Integer, CultureInfo.InvariantCulture, out doubleValue)) result = doubleValue; else converted = false; break; case JsonType.FLOAT: - if (Decimal.TryParse (s, out decimalValue)) + if (Decimal.TryParse (s, NumberStyles.Float, CultureInfo.InvariantCulture, out decimalValue)) result = decimalValue; - else if (Double.TryParse (s, out doubleValue)) + else if (Double.TryParse (s, NumberStyles.Float, CultureInfo.InvariantCulture, out doubleValue)) result = doubleValue; else converted = false; |