Skip Menu |

This queue is for tickets about the Archive-Zip CPAN distribution.

Report information
The Basics
Id: 129531
Status: new
Priority: 0/
Queue: Archive-Zip

Owner: Nobody in particular
Requestors: Sven_Schlittermann [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: extract fails on encrypted data but returns AZ_OK
Date: Fri, 10 May 2019 15:32:44 +0200
To: bug-Archive-Zip [...]
From: Sven Schlittermann <Sven_Schlittermann [...]>
Download (untitled) / with headers
text/plain 1.8k
(Using Debian package libarchive-zip-perl 1.64-1) I got a problem where extractMemberWithoutPaths reports AZ_OK even when it cannot decrypt encrypted member data. I created a zip file with one enrypted member: # echo test > file # zip --encrypt file ... entering a password ... # ls -l file -rw-r--r-- 1 root root 191 May 10 14:59 -rw-r--r-- 1 root root 5 May 10 14:58 file # unzip -t Archive: [] file password: testing: file OK No errors detected in compressed data of (I entered the correct password in "unzip -t") Running the below-attached shows that extractMemberWithoutPaths returns AZ_OK even when no password is given and hence the member cannot get extrated: # perl member: file successfully extracted -rw-r--r-- 1 root root 0 May 10 14:58 /tmp/u_3aPk9gr8 This condition succeeds: if (($zip->extractMemberWithoutPaths($member, $memberfn)) == AZ_OK) and the file named $memberfn is empty. In my opinion this is a bug; the return value should not equal AZ_OK. Another error code should be used to report this error. Sven --------- #!/usr/local/bin/perl # -*- mode: cperl; -*- use strict; use Archive::Zip qw( :ERROR_CODES ); my $fn=""; my $zip = Archive::Zip->new; unless ( $zip->read( $fn ) == AZ_OK ) { die "ZIP read error: $fn\n"; } foreach my $member ($zip->members()) { print "member: ". $member->fileName . "\n"; my $tmpfh = File::Temp->new; my $memberfn = $tmpfh->filename; if (($zip->extractMemberWithoutPaths($member, $memberfn)) == AZ_OK) { print "successfully extracted\n"; system("ls -l $memberfn"); } else { print "cannot extract ZIP archive member: $member\n"; } }

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to