mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Fix crash on screen lock or computer sleep
* Fixes #10455 * Fixes #10432 * Fixes #10415 Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads. Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
This commit is contained in:
@@ -582,7 +582,9 @@ void TestKeePass2Format::testKdbxKeyChange()
|
||||
|
||||
db->setKey(key1);
|
||||
writeKdbx(&buffer, db.data(), hasError, errorString);
|
||||
QVERIFY(!hasError);
|
||||
if (hasError) {
|
||||
QFAIL(qPrintable(QStringLiteral("Error while reading database: ").append(errorString)));
|
||||
}
|
||||
|
||||
// read database
|
||||
db = QSharedPointer<Database>::create();
|
||||
@@ -599,7 +601,9 @@ void TestKeePass2Format::testKdbxKeyChange()
|
||||
// write database
|
||||
buffer.seek(0);
|
||||
writeKdbx(&buffer, db.data(), hasError, errorString);
|
||||
QVERIFY(!hasError);
|
||||
if (hasError) {
|
||||
QFAIL(qPrintable(QStringLiteral("Error while reading database: ").append(errorString)));
|
||||
}
|
||||
|
||||
// read database
|
||||
db = QSharedPointer<Database>::create();
|
||||
|
||||
Reference in New Issue
Block a user