Skip to content

Commit ac2b527

Browse files
authored
Json \u escape sequence was not case insensitive (#1770)
1 parent 294c4b9 commit ac2b527

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Jint.Tests/Runtime/JsonTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public void CanParseTabsInProperties()
2828
[InlineData("{\"a\":\"\\u0000\"}", "\0")]
2929
[InlineData("{\"a\":\"\\u0001\"}", "\x01")]
3030
[InlineData("{\"a\":\"\\u0061\"}", "a")]
31+
[InlineData("{\"a\":\"\\u003C\"}", "<")]
32+
[InlineData("{\"a\":\"\\u003E\"}", ">")]
33+
[InlineData("{\"a\":\"\\u003c\"}", "<")]
34+
[InlineData("{\"a\":\"\\u003e\"}", ">")]
3135
public void ShouldParseEscapedCharactersCorrectly(string json, string expectedCharacter)
3236
{
3337
var engine = new Engine();

Jint/Native/Json/JsonParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private char ScanHexEscape()
103103
{
104104
if (_index < _length + 1 && IsHexDigit(_source[_index]))
105105
{
106-
char ch = _source[_index++];
106+
char ch = char.ToLower(_source[_index++], CultureInfo.InvariantCulture);
107107
code = code * 16 + "0123456789abcdef".IndexOf(ch);
108108
}
109109
else

0 commit comments

Comments
 (0)