Files
keepassxc/tests/TestKeePass1Reader.h
Janek Bevendorff 2082084690 Store only one UUID per entry in KDB reader.
Fixes use-after-free for crafted KeePass1 files with duplicate UUID fields.

Fixes GHSA-3524-mf44-vjr9 (thanks @tntrock)
2026-11-05 08:15:26 +01:00

65 lines
2.0 KiB
C++

/*
* Copyright (C) 2026 Felix Geyer <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEEPASSX_TESTKEEPASS1READER_H
#define KEEPASSX_TESTKEEPASS1READER_H
#include <QDateTime>
#include <QObject>
#include <QSharedPointer>
class Database;
class KeePass1Reader;
class TestKeePass1Reader : public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void testBasic();
void testEntryFields_data();
void testEntryFields();
void testDeletedMetastreamUuidAliases();
void testMetastreamBounds_data();
void testMetastreamBounds();
void testMasterKey();
void testCustomIcons();
void testGroupExpanded();
void testAutoType();
void testFileKey();
void testFileKey_data();
void testCompositeKey();
void testTwofish();
#ifdef Q_OS_WIN
void testCP1252Password();
#endif
void cleanupTestCase();
private:
static void readTestDatabase(const QByteArray& entries,
quint32 entryCount,
KeePass1Reader& reader,
QSharedPointer<Database>& db);
static QDateTime genDT(int year, int month, int day, int hour, int min);
static void reopenDatabase(QSharedPointer<Database> db, const QString& password, const QString& keyfileName);
QSharedPointer<Database> m_db;
};
#endif // KEEPASSX_TESTKEEPASS1READER_H