diff options
author | Tobias Fella <fella@posteo.de> | 2021-08-17 18:10:58 +0200 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2021-12-01 21:56:59 +0100 |
commit | 60bd11426e941f9d349962b8b2ea4bddd9488965 (patch) | |
tree | b8a78bcee52be0055d8eced4e3601087de86c443 /lib/connection.cpp | |
parent | 703b3f89ef54d9d40c9117788d0920b6b745bd62 (diff) | |
download | libquotient-60bd11426e941f9d349962b8b2ea4bddd9488965.tar.gz libquotient-60bd11426e941f9d349962b8b2ea4bddd9488965.zip |
Don't crash when ToDeviceEvent decryption fails
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r-- | lib/connection.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index 4a220e0d..60ffed09 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -798,8 +798,13 @@ void Connection::Private::consumeToDeviceEvents(Events&& toDeviceEvents) qCDebug(E2EE) << "Unsupported algorithm" << event.id() << "for event" << event.algorithm(); return; } + const auto decryptedEvent = sessionDecryptMessage(event); + if(!decryptedEvent) { + qCWarning(E2EE) << "Failed to decrypt event" << event.id(); + return; + } - visit(*sessionDecryptMessage(event), + visit(*decryptedEvent, [this, senderKey = event.senderKey()](const RoomKeyEvent& roomKeyEvent) { if (auto* detectedRoom = q->room(roomKeyEvent.roomId())) { detectedRoom->handleRoomKeyEvent(roomKeyEvent, senderKey); |