diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-12-29 22:18:45 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-29 22:20:21 +0100 |
commit | 821484f170000e68114285b538c563be9858d119 (patch) | |
tree | 18a690f5360dbbb76dc8cc9bee696ab51b360c53 /AK/JsonParser.cpp | |
parent | d1d7db274596c8a362a6fb877a75baa653a2e6f7 (diff) | |
download | serenity-821484f170000e68114285b538c563be9858d119.zip |
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!
Diffstat (limited to 'AK/JsonParser.cpp')
-rw-r--r-- | AK/JsonParser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/AK/JsonParser.cpp b/AK/JsonParser.cpp index 774def6e4c..5c634f27de 100644 --- a/AK/JsonParser.cpp +++ b/AK/JsonParser.cpp @@ -103,7 +103,7 @@ String JsonParser::consume_quoted_string() if (buffer.is_empty()) return String::empty(); - auto& last_string_starting_with_character = m_last_string_starting_with_character[(int)buffer.first()]; + auto& last_string_starting_with_character = m_last_string_starting_with_character[(u8)buffer.first()]; if (last_string_starting_with_character.length() == (size_t)buffer.size()) { if (!memcmp(last_string_starting_with_character.characters(), buffer.data(), buffer.size())) return last_string_starting_with_character; |