From 65f34b6f2a95f228897a88c1a2f99f26c8e9fc74 Mon Sep 17 00:00:00 2001 From: Roger Sanders Date: Thu, 3 Apr 2025 11:51:17 +1100 Subject: [PATCH] Fix non-standard Zip64 extended information fields being generated --- CPP/7zip/Archive/Zip/ZipOut.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CPP/7zip/Archive/Zip/ZipOut.cpp b/CPP/7zip/Archive/Zip/ZipOut.cpp index 63f1a71..ffad1bb 100644 --- a/CPP/7zip/Archive/Zip/ZipOut.cpp +++ b/CPP/7zip/Archive/Zip/ZipOut.cpp @@ -302,7 +302,7 @@ void COutArchive::WriteCentralHeader(const CItemOut &item) Write16((UInt16)item.Name.Len()); - const UInt16 zip64ExtraSize = (UInt16)((isUnPack64 ? 8: 0) + (isPack64 ? 8: 0) + (isPosition64 ? 8: 0)); + const UInt16 zip64ExtraSize = (UInt16)((isUnPack64 || isPack64 || isPosition64 ? 16: 0) + (isPosition64 ? 8: 0)); const bool writeNtfs = item.Write_NtfsTime; const size_t centralExtraSize = (isZip64 ? 4 + zip64ExtraSize : 0) @@ -330,10 +330,8 @@ void COutArchive::WriteCentralHeader(const CItemOut &item) { Write16(NFileHeader::NExtraID::kZip64); Write16(zip64ExtraSize); - if (isUnPack64) - Write64(item.Size); - if (isPack64) - Write64(item.PackSize); + Write64(item.Size); + Write64(item.PackSize); if (isPosition64) Write64(item.LocalHeaderPos); }