summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-04-25 12:33:26 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-04-26 13:07:05 +0200
commit4173fa8150e5b31a6f40ba119d3b4dcdf3340695 (patch)
treef7759d525b9ad1d09008f0bacb1d95d725b13a61
parenttdf#154957 Revert "use OutputDevice clipping if its just a set of rectangles" (diff)
downloadcore-4173fa8150e5b31a6f40ba119d3b4dcdf3340695.tar.gz
core-4173fa8150e5b31a6f40ba119d3b4dcdf3340695.zip
tdf#155005 fail gracefully on encountering a negative compression value
we are using sal_Int64 for this so a large enough value can be interpreted as negative here Change-Id: Id547a24591aca4b6ed7b7955621641a0666b0bd5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150926 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--package/source/zipapi/ZipFile.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 828033688189..d5c6411e48a6 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -1204,6 +1204,12 @@ bool ZipFile::checkSizeAndCRC( const ZipEntry& aEntry )
if( aEntry.nMethod == STORED )
return ( getCRC( aEntry.nOffset, aEntry.nSize ) == aEntry.nCrc );
+ if (aEntry.nCompressedSize < 0)
+ {
+ SAL_WARN("package", "bogus compressed size of: " << aEntry.nCompressedSize);
+ return false;
+ }
+
getSizeAndCRC( aEntry.nOffset, aEntry.nCompressedSize, &nSize, &nCRC );
return ( aEntry.nSize == nSize && aEntry.nCrc == nCRC );
}