summaryrefslogtreecommitdiff
path: root/package/source
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2024-07-02 11:47:17 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2024-07-02 18:44:44 +0200
commit67cb6af482bc5b0f4d310f0a42a85057f3db0267 (patch)
treea33bc6c54412da23c866790e483f1cdaee57f890 /package/source
parentb32aa67f17a645c1d6f2b544d315f12bad123547 (diff)
package: ZipFile: don't accept duplicate CEN entries
Change-Id: Ice341a11346b445c555cba276bf2284e4f9b6685 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169881 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'package/source')
-rw-r--r--package/source/zipapi/ZipFile.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 793b5f9c40fe..b1df020ea219 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -1153,7 +1153,15 @@ sal_Int32 ZipFile::readCEN()
continue; // This is a directory entry, not a stream - skip it
}
- aEntries[aEntry.sPath] = aEntry;
+ if (auto it = aEntries.find(aEntry.sPath); it == aEntries.end())
+ {
+ aEntries[aEntry.sPath] = aEntry;
+ }
+ else
+ {
+ SAL_INFO("package", "Duplicate CEN entry: \"" << aEntry.sPath << "\"");
+ throw ZipException(u"Duplicate CEN entry"_ustr);
+ }
}
if (nCount != nTotal)