mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-08 18:58:29 -05:00
parent
154f1673e9
commit
c6105a08ab
@ -357,7 +357,7 @@ void KeePass2XmlReader::parseIcon()
|
|||||||
while (!m_xml.error() && m_xml.readNextStartElement()) {
|
while (!m_xml.error() && m_xml.readNextStartElement()) {
|
||||||
if (m_xml.name() == "UUID") {
|
if (m_xml.name() == "UUID") {
|
||||||
uuid = readUuid();
|
uuid = readUuid();
|
||||||
uuidSet = true;
|
uuidSet = !uuid.isNull();
|
||||||
}
|
}
|
||||||
else if (m_xml.name() == "Data") {
|
else if (m_xml.name() == "Data") {
|
||||||
icon.loadFromData(readBinary());
|
icon.loadFromData(readBinary());
|
||||||
@ -1104,7 +1104,10 @@ int KeePass2XmlReader::readNumber()
|
|||||||
Uuid KeePass2XmlReader::readUuid()
|
Uuid KeePass2XmlReader::readUuid()
|
||||||
{
|
{
|
||||||
QByteArray uuidBin = readBinary();
|
QByteArray uuidBin = readBinary();
|
||||||
if (uuidBin.length() != Uuid::Length) {
|
if (uuidBin.isEmpty()) {
|
||||||
|
return Uuid();
|
||||||
|
}
|
||||||
|
else if (uuidBin.length() != Uuid::Length) {
|
||||||
if (m_strictMode) {
|
if (m_strictMode) {
|
||||||
raiseError("Invalid uuid value");
|
raiseError("Invalid uuid value");
|
||||||
}
|
}
|
||||||
|
@ -395,6 +395,19 @@ void TestKeePass2XmlReader::testBroken_data()
|
|||||||
QTest::newRow("BrokenDeletedObjects (not strict)") << "BrokenDeletedObjects" << false << false;
|
QTest::newRow("BrokenDeletedObjects (not strict)") << "BrokenDeletedObjects" << false << false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestKeePass2XmlReader::testEmptyUuids()
|
||||||
|
{
|
||||||
|
KeePass2XmlReader reader;
|
||||||
|
reader.setStrictMode(true);
|
||||||
|
QString xmlFile = QString("%1/%2.xml").arg(KEEPASSX_TEST_DATA_DIR, "EmptyUuids");
|
||||||
|
QVERIFY(QFile::exists(xmlFile));
|
||||||
|
QScopedPointer<Database> db(reader.readDatabase(xmlFile));
|
||||||
|
if (reader.hasError()) {
|
||||||
|
qWarning("Reader error: %s", qPrintable(reader.errorString()));
|
||||||
|
}
|
||||||
|
QVERIFY(!reader.hasError());
|
||||||
|
}
|
||||||
|
|
||||||
void TestKeePass2XmlReader::cleanupTestCase()
|
void TestKeePass2XmlReader::cleanupTestCase()
|
||||||
{
|
{
|
||||||
delete m_db;
|
delete m_db;
|
||||||
|
@ -41,6 +41,7 @@ private Q_SLOTS:
|
|||||||
void testDeletedObjects();
|
void testDeletedObjects();
|
||||||
void testBroken();
|
void testBroken();
|
||||||
void testBroken_data();
|
void testBroken_data();
|
||||||
|
void testEmptyUuids();
|
||||||
void cleanupTestCase();
|
void cleanupTestCase();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user