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

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


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

commit 97990b7f182cd0cb81f6957c06a2dcaaeab6217d
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/zipapi/ZipFile.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/main/package/source/zipapi/ZipFile.cxx 
b/main/package/source/zipapi/ZipFile.cxx
index 7a6da24a6a..dace910312 100644
--- a/main/package/source/zipapi/ZipFile.cxx
+++ b/main/package/source/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