2
0
Эх сурвалжийг харах

Json \u escape sequence was not case insensitive (#1770)

tomatosalat0 1 жил өмнө
parent
commit
ac2b527fcf

+ 4 - 0
Jint.Tests/Runtime/JsonTests.cs

@@ -28,6 +28,10 @@ namespace Jint.Tests.Runtime
         [InlineData("{\"a\":\"\\u0000\"}", "\0")]
         [InlineData("{\"a\":\"\\u0001\"}", "\x01")]
         [InlineData("{\"a\":\"\\u0061\"}", "a")]
+        [InlineData("{\"a\":\"\\u003C\"}", "<")]
+        [InlineData("{\"a\":\"\\u003E\"}", ">")]
+        [InlineData("{\"a\":\"\\u003c\"}", "<")]
+        [InlineData("{\"a\":\"\\u003e\"}", ">")]
         public void ShouldParseEscapedCharactersCorrectly(string json, string expectedCharacter)
         {
             var engine = new Engine();

+ 1 - 1
Jint/Native/Json/JsonParser.cs

@@ -103,7 +103,7 @@ namespace Jint.Native.Json
             {
                 if (_index < _length + 1 && IsHexDigit(_source[_index]))
                 {
-                    char ch = _source[_index++];
+                    char ch = char.ToLower(_source[_index++], CultureInfo.InvariantCulture);
                     code = code * 16 + "0123456789abcdef".IndexOf(ch);
                 }
                 else