mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
AK: Fix JSON parser crashing when encountering UTF-8
The mechanism that caches the most recently seen string for each first character was indexing into the cache using a 'char' subscript. Oops!
This commit is contained in:
parent
d1d7db2745
commit
821484f170
2 changed files with 9 additions and 1 deletions
|
@ -74,4 +74,12 @@ TEST_CASE(json_empty_string)
|
|||
EXPECT_EQ(json.as_string().is_empty(), true);
|
||||
}
|
||||
|
||||
TEST_CASE(json_utf8_character)
|
||||
{
|
||||
auto json = JsonValue::from_string("\"\xc3\x84\"");
|
||||
EXPECT_EQ(json.type(), JsonValue::Type::String);
|
||||
EXPECT_EQ(json.as_string().is_null(), false);
|
||||
EXPECT_EQ(json.as_string().length(), 2);
|
||||
}
|
||||
|
||||
TEST_MAIN(JSON)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue