Allow some wrongly created files to be decompressed

Resolves: RHEL-86228
This commit is contained in:
Jakub Martisko 2025-04-07 16:06:05 +02:00
parent 8804116fd0
commit 4ae2cd013e
2 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,19 @@
From: Roy Tam
Subject: Handle Microsoft ZIP64 files by ignoring invalid "Total number of disks" field
Origin: https://sourceforge.net/p/infozip/bugs/42/
Bug: https://sourceforge.net/p/infozip/bugs/42/
Bug-Debian: https://bugs.debian.org/1064000
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/unzip/+bug/2051952
X-Debian-version: 6.0-29
--- a/process.c
+++ b/process.c
@@ -1281,7 +1281,7 @@
fprintf(stdout,"\nnumber of disks (ECR) %u, (ECLOC64) %lu\n",
G.ecrec.number_this_disk, ecloc64_total_disks); fflush(stdout);
#endif
- if ((G.ecrec.number_this_disk != 0xFFFF) &&
+ if ((G.ecrec.number_this_disk != 0xFFFF) && ecloc64_total_disks &&
(G.ecrec.number_this_disk != ecloc64_total_disks - 1)) {
/* Note: For some unknown reason, the developers at PKWARE decided to
store the "zip64 total disks" value as a counter starting from 1,

View File

@ -7,7 +7,7 @@
Summary: A utility for unpacking zip files
Name: unzip
Version: 6.0
Release: 58%{?dist}
Release: 59%{?dist}
License: BSD
Source: http://downloads.sourceforge.net/infozip/unzip60.tar.gz
@ -75,6 +75,9 @@ Patch33: unzip-zipbomb-switch.patch
Patch34: unzip-6.0-fix-warning-messages-on-big-files.patch
#https://sources.debian.org/src/unzip/6.0-29/debian/patches/29-handle-windows-zip64-files.patch/
Patch35: unzip-6.0-RHEL-86228.patch
URL: http://www.info-zip.org/UnZip.html
BuildRequires: make
BuildRequires: bzip2-devel, gcc
@ -127,6 +130,7 @@ a zip archive.
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%build
# Use the C implementation of CRC instead of assembly (only on i386, other architectures use C by default)
@ -150,6 +154,10 @@ make -f unix/Makefile prefix=$RPM_BUILD_ROOT%{_prefix} MANDIR=$RPM_BUILD_ROOT/%{
%{_mandir}/*/*
%changelog
* Mon Apr 07 2025 Jakub Martisko <jamartis@redhat.com> - 6.0-59
- Allow decompression of some wrongly compressed files
Resolves: RHEL-86228
* Tue Sep 24 2024 Matteo Croce <teknoraver@meta.com> - 6.0-58
- Fix obscure invalid memory access in zipinfo
Resolves: RHEL-60054