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

People
Owner: Nobody in particular
Requestors: Sven_Schlittermann [...] drewag.de
Cc:
AdminCc:

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 [...] rt.cpan.org
From: Sven Schlittermann <Sven_Schlittermann [...] drewag.de>
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 archive.zip file ... entering a password ... # ls -l file archive.zip -rw-r--r-- 1 root root 191 May 10 14:59 archive.zip -rw-r--r-- 1 root root 5 May 10 14:58 file # unzip -t archive.zip Archive: archive.zip [archive.zip] file password: testing: file OK No errors detected in compressed data of archive.zip. (I entered the correct password in "unzip -t") Running the below-attached script.pl shows that extractMemberWithoutPaths returns AZ_OK even when no password is given and hence the member cannot get extrated: # perl script.pl 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="archive.zip"; 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 Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.