[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - package/source

Caolán McNamara caolanm at redhat.com
Fri Feb 23 15:46:33 UTC 2018


 package/source/zipapi/ZipFile.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 060c6a01a23375ba60ac8158e1b97edc9ac49f03
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 23 12:53:34 2018 +0000

    forcepoint #5 check for short read
    
    a zip file within a structured storage stream. underlying storage stream
    claims larger size that it can satisfy on read
    
    Change-Id: I8516b12df33ad78b2525192826f5e3aef2622eb8
    Reviewed-on: https://gerrit.libreoffice.org/50239
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 6e9351c69f1a..1ef81bf582a5 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -838,11 +838,14 @@ sal_Int32 ZipFile::findEND()
         nEnd = nPos >= 0 ? nPos : 0 ;
 
         aGrabber.seek( nEnd );
-        aGrabber.readBytes ( aBuffer, nLength - nEnd );
+
+        auto nSize = nLength - nEnd;
+        if (nSize != aGrabber.readBytes(aBuffer, nSize))
+            throw ZipException("Zip END signature not found!" );
 
         const sal_Int8 *pBuffer = aBuffer.getConstArray();
 
-        nPos = nLength - nEnd - ENDHDR;
+        nPos = nSize - ENDHDR;
         while ( nPos >= 0 )
         {
             if (pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 5 && pBuffer[nPos+3] == 6 )


More information about the Libreoffice-commits mailing list