summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-04-25 12:33:26 +0100
committerAron Budea <aron.budea@collabora.com>2023-05-02 06:31:10 +0200
commit1b3b2e6b1b7080d04fc66c90918423c0373a7a4d (patch)
tree91436fad10c5a118f8267a781ef22a85bb1dfae5 /package
parent3e418c2a92f0c3fb95929245421b0387976b64c2 (diff)
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/+/150968 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 80805716a409c34203b059f3e03cd934367186c3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150976 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Aron Budea <aron.budea@collabora.com>
Diffstat (limited to 'package')
-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 862ac7a78250..f3851401bb0a 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -1274,6 +1274,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 );
}