diff --git a/src/core/coreencryption.cpp b/src/core/coreencryption.cpp index 8a182b972..ae1813e86 100644 --- a/src/core/coreencryption.cpp +++ b/src/core/coreencryption.cpp @@ -75,6 +75,11 @@ QByteArray Core::decryptData(const QByteArray &data) QByteArray Core::decryptData(const QByteArray& data, const TOX_PASS_KEY& encryptionKey) { + if (data.size() < TOX_PASS_ENCRYPTION_EXTRA_LENGTH) + { + qWarning() << "Not enough data:"<(data.data()), data.size(), diff --git a/src/persistence/profile.cpp b/src/persistence/profile.cpp index d0e92e979..bd263b924 100644 --- a/src/persistence/profile.cpp +++ b/src/persistence/profile.cpp @@ -369,7 +369,7 @@ QByteArray Profile::loadAvatarData(const QString &ownerId) return {}; QByteArray pic = file.readAll(); - if (encrypted) + if (encrypted && !pic.isEmpty()) { uint8_t salt[TOX_PASS_SALT_LENGTH]; tox_get_salt(reinterpret_cast(pic.data()), salt);