Skip Menu |
 

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

Report information
The Basics
Id: 101240
Status: resolved
Priority: 0/
Queue: Archive-Zip

People
Owner: Nobody in particular
Requestors: pmqs [...] cpan.org
Cc:
AdminCc:

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



Subject: Possible issue with zero length files on Win32 when UNICODE is enabled
Download (untitled) / with headers
text/plain 730b
This section of code in extractToFileNamed doesn't look right. I don't have a Win32 setup to test it, but my reading of the code suggests that a zero length file stored in a zip archive will not be unzipped correctly when $Archive::Zip::UNICODE has been set. if ($^O eq 'MSWin32' && $Archive::Zip::UNICODE) { $name = decode_utf8(Win32::GetFullPathName($name)); mkpath_win32($name); if ($self->{'compressedSize'} == 0) { return; } else { Win32::CreateFile($name); } I think that any leading path will get created ok (via mkpath_win32), but the test for compressedSize == 0 will prevent the zero length file from getting created.
Download (untitled) / with headers
text/plain 207b
Found a Windows setup to verify that empty members don't get extracted when UNICODE is enabled. Health Warning - I don't do Winows development, so the enclosed patch needs verified by someone who does.
Subject: 101240.patch
Download 101240.patch
text/x-diff 971b
diff --git a/MANIFEST b/MANIFEST index 2f9d199..17d481f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -51,6 +51,7 @@ t/15_decrypt.t t/16_decrypt.t t/17_101092.t t/18_bug_92205.t +t/19_bug_101240.t t/badjpeg/expected.jpg t/badjpeg/source.zip t/common.pm diff --git a/lib/Archive/Zip/Member.pm b/lib/Archive/Zip/Member.pm index f440a36..b2ae11a 100644 --- a/lib/Archive/Zip/Member.pm +++ b/lib/Archive/Zip/Member.pm @@ -496,11 +496,7 @@ sub extractToFileNamed { if ($^O eq 'MSWin32' && $Archive::Zip::UNICODE) { $name = decode_utf8(Win32::GetFullPathName($name)); mkpath_win32($name); - if ($self->{'compressedSize'} == 0) { - return; - } else { - Win32::CreateFile($name); - } + Win32::CreateFile($name); ($status, $fh) = _newFileHandle(Win32::GetANSIPathName($name), 'w'); } else { mkpath(dirname($name)); # croaks on error
Subject: 101240.tar
Download 101240.tar
application/x-tar 10k

Message body not shown because it is not plain text.

Thanks, releasing 1.42 with this today. Removed 1.41 changes also since regression was caused.
Thanks, releasing 1.42 with this today. Removed 1.41 changes also since regression was caused.


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.