You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2026/04/11 13:26:23 UTC

(openoffice) branch trunk updated: Fix a bug with ZIP extra fields.

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

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


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

commit d6c7ae7720ddc812112d7577125e4a874e26ad2c
Author: Arrigo Marchiori <ar...@yahoo.it>
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.
---
 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;
 	}
 }