Skip to content

Commit

Permalink
Json \u escape sequence was not case insensitive (#1770)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomatosalat0 authored Feb 2, 2024
1 parent 294c4b9 commit ac2b527
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Jint.Tests/Runtime/JsonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public void CanParseTabsInProperties()
[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();
Expand Down
2 changes: 1 addition & 1 deletion Jint/Native/Json/JsonParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private char ScanHexEscape()
{
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
Expand Down

0 comments on commit ac2b527

Please sign in to comment.