mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-21 12:38:12 -04:00
Merge branch '2.0'
This commit is contained in:
commit
d6d92ce90a
20 changed files with 382 additions and 176 deletions
|
@ -901,10 +901,10 @@ bool KeePass1Reader::parseCustomIcons4(const QByteArray& data)
|
|||
QByteArray entryUuid = data.mid(pos, 16);
|
||||
pos += 16;
|
||||
|
||||
int iconId = Endian::bytesToUInt32(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
quint32 iconId = Endian::bytesToUInt32(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
if (m_entryUuids.contains(entryUuid) && (iconId < iconUuids.size())) {
|
||||
if (m_entryUuids.contains(entryUuid) && (iconId < static_cast<quint32>(iconUuids.size()))) {
|
||||
m_entryUuids[entryUuid]->setIcon(iconUuids[iconId]);
|
||||
}
|
||||
}
|
||||
|
@ -917,10 +917,10 @@ bool KeePass1Reader::parseCustomIcons4(const QByteArray& data)
|
|||
quint32 groupId = Endian::bytesToUInt32(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
int iconId = Endian::bytesToUInt32(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
quint32 iconId = Endian::bytesToUInt32(data.mid(pos, 4), KeePass1::BYTEORDER);
|
||||
pos += 4;
|
||||
|
||||
if (m_groupIds.contains(groupId) && (iconId < iconUuids.size())) {
|
||||
if (m_groupIds.contains(groupId) && (iconId < static_cast<quint32>(iconUuids.size()))) {
|
||||
m_groupIds[groupId]->setIcon(iconUuids[iconId]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ KeePass2Repair::RepairResult KeePass2Repair::repairDatabase(QIODevice* device, c
|
|||
|
||||
// try to fix broken databases because of bug #392
|
||||
for (int i = (xmlData.size() - 1); i >= 0; i--) {
|
||||
char ch = xmlData.at(i);
|
||||
quint8 ch = static_cast<quint8>(xmlData.at(i));
|
||||
if (ch < 0x20 && ch != 0x09 && ch != 0x0A && ch != 0x0D) {
|
||||
xmlData.remove(i, 1);
|
||||
repairAction = true;
|
||||
|
|
|
@ -523,6 +523,7 @@ Group* KeePass2XmlReader::parseGroup()
|
|||
if (m_strictMode) {
|
||||
raiseError("Invalid group icon number");
|
||||
}
|
||||
iconId = 0;
|
||||
}
|
||||
else {
|
||||
if (iconId >= DatabaseIcons::IconCount) {
|
||||
|
@ -702,6 +703,7 @@ Entry* KeePass2XmlReader::parseEntry(bool history)
|
|||
if (m_strictMode) {
|
||||
raiseError("Invalid entry icon number");
|
||||
}
|
||||
iconId = 0;
|
||||
}
|
||||
else {
|
||||
entry->setIcon(iconId);
|
||||
|
|
|
@ -550,11 +550,19 @@ QString KeePass2XmlWriter::colorPartToString(int value)
|
|||
QString KeePass2XmlWriter::stripInvalidXml10Chars(QString str)
|
||||
{
|
||||
for (int i = str.size() - 1; i >= 0; i--) {
|
||||
const ushort uc = str.at(i).unicode();
|
||||
const QChar ch = str.at(i);
|
||||
const ushort uc = ch.unicode();
|
||||
|
||||
if ((uc < 0x20 && uc != 0x09 && uc != 0x0A && uc != 0x0D)
|
||||
|| (uc > 0xD7FF && uc < 0xE000)
|
||||
|| (uc > 0xFFFD))
|
||||
if (ch.isLowSurrogate() && i != 0 && str.at(i - 1).isHighSurrogate()) {
|
||||
// keep valid surrogate pair
|
||||
i--;
|
||||
}
|
||||
else if ((uc < 0x20 && uc != 0x09 && uc != 0x0A && uc != 0x0D) // control chracters
|
||||
|| (uc >= 0x7F && uc <= 0x84) // control chracters, valid but discouraged by XML
|
||||
|| (uc >= 0x86 && uc <= 0x9F) // control chracters, valid but discouraged by XML
|
||||
|| (uc > 0xFFFD) // noncharacter
|
||||
|| ch.isLowSurrogate() // single low surrogate
|
||||
|| ch.isHighSurrogate()) // single high surrogate
|
||||
{
|
||||
qWarning("Stripping invalid XML 1.0 codepoint %x", uc);
|
||||
str.remove(i, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue