fix buffer overflow in parseEmoji (#2602)

Co-authored-by: Paweł <zneix@zneix.eu>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Yoitsu 2021-04-10 14:49:25 +03:00 committed by GitHub
parent 208d017cc3
commit bc334222c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -87,6 +87,7 @@
- Bugfix: Fix directory not opening when clicking "Open AppData Directory" setting button on macOS (#2531, #2537)
- Bugfix: Fix quickswitcher not respecting order of tabs when filtering (#2519, #2561)
- Bugfix: Fix GNOME not associating Chatterino's window with its desktop entry (#1863, #2587)
- Bugfix: Fix buffer overflow in emoji parsing. (#2602)
- Dev: Updated minimum required Qt framework version to 5.12. (#2210)
- Dev: Migrated `Kraken::getUser` to Helix (#2260)
- Dev: Migrated `TwitchAccount::(un)followUser` from Kraken to Helix and moved it to `Helix::(un)followUser`. (#2306)

View file

@ -24,7 +24,7 @@ namespace {
const rapidjson::Value &unparsedEmoji,
QString shortCode = QString())
{
static uint unicodeBytes[4];
std::array<uint32_t, 7> unicodeBytes;
struct {
bool apple;
@ -91,11 +91,12 @@ namespace {
for (const QString &unicodeCharacter : unicodeCharacters)
{
unicodeBytes[numUnicodeBytes++] =
unicodeBytes.at(numUnicodeBytes++) =
QString(unicodeCharacter).toUInt(nullptr, 16);
}
emojiData->value = QString::fromUcs4(unicodeBytes, numUnicodeBytes);
emojiData->value =
QString::fromUcs4(unicodeBytes.data(), numUnicodeBytes);
}
// getToneNames takes a tones and returns their names in the same order