This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO42X by this push:
     new bbd3131e18 Fix a bug with ZIP extra fields.
bbd3131e18 is described below

commit bbd3131e185105d2906a511faaf9828b5d25dcad
Author: Arrigo Marchiori <[email protected]>
AuthorDate: Sat Apr 11 15:24:20 2026 +0200

    Fix a bug with ZIP extra fields.
    
    Valid ZIP file entries with more than 1 extra field were considered invalid.
    
    (cherry picked from commit d6c7ae7720ddc812112d7577125e4a874e26ad2c)
---
 main/package/source/package/zipapi/ZipFile.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/main/package/source/package/zipapi/ZipFile.cxx 
b/main/package/source/package/zipapi/ZipFile.cxx
index c58ef3bd0a..3c40b92ce6 100644
--- a/main/package/source/package/zipapi/ZipFile.cxx
+++ b/main/package/source/package/zipapi/ZipFile.cxx
@@ -662,7 +662,7 @@ static void readExtraFields( MemoryByteGrabber 
&rMemGrabber, sal_Int16 nLength,
        while ( ( nLength - nReadBytes ) >= 2 ) {
                rMemGrabber >> nHeaderID;
                rMemGrabber >> nDataSize;
-               nReadBytes += 2;
+               nReadBytes += 4;
                if (( nDataSize > ( nLength - nReadBytes ) ) ||
                        ( nDataSize > rMemGrabber.available() ) )
                        throw ZipException( OUString( 
RTL_CONSTASCII_USTRINGPARAM ( "Invalid ZIP extra fields" ) ), uno::Reference < 
XInterface > () );
@@ -682,6 +682,7 @@ static void readExtraFields( MemoryByteGrabber 
&rMemGrabber, sal_Int16 nLength,
                default:  // We are not interested in this field
                        rMemGrabber.skipBytes( nDataSize );
                }
+               nReadBytes += nDataSize;
        }
 }
 

Reply via email to