This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository libarchive-zip-perl.

commit 720cf082ad23414e7ac211576626e4f4a3328667
Author: gregor herrmann <gre...@debian.org>
Date:   Thu Jun 18 18:34:43 2015 +0200

    Imported Upstream version 1.47
---
 Changes                               |   4 ++++
 MANIFEST                              |   7 ++++++
 META.json                             |   4 ++--
 META.yml                              |  34 ++++++++++++++---------------
 lib/Archive/Zip.pm                    |   2 +-
 lib/Archive/Zip/Archive.pm            |  11 +++++++++-
 lib/Archive/Zip/BufferedFileHandle.pm |   2 +-
 lib/Archive/Zip/DirectoryMember.pm    |   2 +-
 lib/Archive/Zip/FileMember.pm         |   2 +-
 lib/Archive/Zip/Member.pm             |   3 ++-
 lib/Archive/Zip/MemberRead.pm         |   2 +-
 lib/Archive/Zip/MockFileHandle.pm     |   2 +-
 lib/Archive/Zip/NewFileMember.pm      |   2 +-
 lib/Archive/Zip/StringMember.pm       |   2 +-
 lib/Archive/Zip/Tree.pm               |   2 +-
 lib/Archive/Zip/ZipFileMember.pm      |   2 +-
 t/20_bug_github11.t                   |  39 ++++++++++++++++++++++++++++++++++
 t/21_zip64.t                          |  20 +++++++++++++++++
 t/22_deflated_dir.t                   |  23 ++++++++++++++++++++
 t/data/bad_github11.zip               | Bin 0 -> 455 bytes
 t/data/good_github11.zip              | Bin 0 -> 407 bytes
 t/data/jar.zip                        | Bin 0 -> 448 bytes
 t/data/zip64.zip                      | Bin 0 -> 242 bytes
 23 files changed, 134 insertions(+), 31 deletions(-)

diff --git a/Changes b/Changes
index e9640b6..8a44bfa 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 Revision history for Perl extension Archive-Zip
 
+1.47 Wed 17 Jun 2015
+    - zip file with a deflated directory cannot be written out again 
[github/ntyni]
+    - add missing test data to MANIFEST
+
 1.46 Tue 24 Mar 2015
     - "CRC or size mismatch" when extracting member second time [github/AGWA 
github/pwr22]
 
diff --git a/MANIFEST b/MANIFEST
index 17d481f..57ec4c7 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -52,14 +52,20 @@ t/16_decrypt.t
 t/17_101092.t
 t/18_bug_92205.t
 t/19_bug_101240.t
+t/20_bug_github11.t
+t/21_zip64.t
+t/22_deflated_dir.t
 t/badjpeg/expected.jpg
 t/badjpeg/source.zip
 t/common.pm
+t/data/bad_github11.zip
 t/data/chmod.zip
 t/data/crypcomp.zip
 t/data/crypt.zip
 t/data/def.zip
 t/data/defstr.zip
+t/data/good_github11.zip
+t/data/jar.zip
 t/data/store.zip
 t/data/storestr.zip
 t/data/emptydef.zip
@@ -71,5 +77,6 @@ t/data/mkzip.pl
 t/data/perl.zip
 t/data/streamed.zip
 t/data/winzip.zip
+t/data/zip64.zip
 META.yml                                 Module YAML meta-data (added by 
MakeMaker)
 META.json                                Module JSON meta-data (added by 
MakeMaker)
diff --git a/META.json b/META.json
index 6ac0c94..2024157 100644
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
       "Ned Konz <p...@bike-nomad.com>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter 
version 2.142690",
+   "generated_by" : "ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter 
version 2.120630",
    "license" : [
       "perl_5"
    ],
@@ -53,5 +53,5 @@
          "url" : "https://github.com/redhotpenguin/perl-Archive-Zip-svn";
       }
    },
-   "version" : "1.46"
+   "version" : "1.47"
 }
diff --git a/META.yml b/META.yml
index 43aff61..db96369 100644
--- a/META.yml
+++ b/META.yml
@@ -3,33 +3,33 @@ abstract: 'Provide an interface to ZIP archive files.'
 author:
   - 'Ned Konz <p...@bike-nomad.com>'
 build_requires:
-  Test::More: '0.88'
+  Test::More: 0.88
 configure_requires:
-  ExtUtils::MakeMaker: '0'
+  ExtUtils::MakeMaker: 0
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter 
version 2.142690'
+generated_by: 'ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter 
version 2.120630'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: '1.4'
+  version: 1.4
 name: Archive-Zip
 no_index:
   directory:
     - t
     - inc
 requires:
-  Compress::Raw::Zlib: '2.017'
-  File::Basename: '0'
-  File::Copy: '0'
-  File::Find: '0'
-  File::Path: '0'
-  File::Spec: '0.80'
-  File::Temp: '0'
-  IO::File: '0'
-  IO::Handle: '0'
-  IO::Seekable: '0'
-  Time::Local: '0'
-  perl: '5.006'
+  Compress::Raw::Zlib: 2.017
+  File::Basename: 0
+  File::Copy: 0
+  File::Find: 0
+  File::Path: 0
+  File::Spec: 0.80
+  File::Temp: 0
+  IO::File: 0
+  IO::Handle: 0
+  IO::Seekable: 0
+  Time::Local: 0
+  perl: 5.006
 resources:
   repository: https://github.com/redhotpenguin/perl-Archive-Zip-svn
-version: '1.46'
+version: 1.47
diff --git a/lib/Archive/Zip.pm b/lib/Archive/Zip.pm
index 786eed7..1da6f6d 100644
--- a/lib/Archive/Zip.pm
+++ b/lib/Archive/Zip.pm
@@ -14,7 +14,7 @@ use FileHandle          ();
 use vars qw( $VERSION @ISA );
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
 
     require Exporter;
     @ISA = qw( Exporter );
diff --git a/lib/Archive/Zip/Archive.pm b/lib/Archive/Zip/Archive.pm
index ae87a3c..9f572fe 100644
--- a/lib/Archive/Zip/Archive.pm
+++ b/lib/Archive/Zip/Archive.pm
@@ -13,7 +13,7 @@ use Cwd;
 use vars qw( $VERSION @ISA );
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
     @ISA     = qw( Archive::Zip );
 
     if ($^O eq 'MSWin32') {
@@ -657,6 +657,15 @@ sub _readEndOfCentralDirectory {
         $zipfileCommentLength
     ) = unpack(END_OF_CENTRAL_DIRECTORY_FORMAT, $header);
 
+    if ($self->{'diskNumber'} == 0xFFFF ||
+           $self->{'diskNumberWithStartOfCentralDirectory'} == 0xFFFF ||
+           $self->{'numberOfCentralDirectoriesOnThisDisk'} == 0xFFFF ||
+           $self->{'numberOfCentralDirectories'} == 0xFFFF ||
+           $self->{'centralDirectorySize'} == 0xFFFFFFFF ||
+           $self->{'centralDirectoryOffsetWRTStartingDiskNumber'} == 
0xFFFFFFFF) {
+        return _formatError("zip64 not supported");
+    }
+
     if ($zipfileCommentLength) {
         my $zipfileComment = '';
         $bytesRead = $fh->read($zipfileComment, $zipfileCommentLength);
diff --git a/lib/Archive/Zip/BufferedFileHandle.pm 
b/lib/Archive/Zip/BufferedFileHandle.pm
index e0ae642..ab049f1 100644
--- a/lib/Archive/Zip/BufferedFileHandle.pm
+++ b/lib/Archive/Zip/BufferedFileHandle.pm
@@ -13,7 +13,7 @@ use Carp;
 use vars qw{$VERSION};
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
     $VERSION = eval $VERSION;
 }
 
diff --git a/lib/Archive/Zip/DirectoryMember.pm 
b/lib/Archive/Zip/DirectoryMember.pm
index 7309a59..d2dd840 100644
--- a/lib/Archive/Zip/DirectoryMember.pm
+++ b/lib/Archive/Zip/DirectoryMember.pm
@@ -6,7 +6,7 @@ use File::Path;
 use vars qw( $VERSION @ISA );
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
     @ISA     = qw( Archive::Zip::Member );
 }
 
diff --git a/lib/Archive/Zip/FileMember.pm b/lib/Archive/Zip/FileMember.pm
index 7092993..0577112 100644
--- a/lib/Archive/Zip/FileMember.pm
+++ b/lib/Archive/Zip/FileMember.pm
@@ -4,7 +4,7 @@ use strict;
 use vars qw( $VERSION @ISA );
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
     @ISA     = qw ( Archive::Zip::Member );
 }
 
diff --git a/lib/Archive/Zip/Member.pm b/lib/Archive/Zip/Member.pm
index a5866e4..9c8995d 100644
--- a/lib/Archive/Zip/Member.pm
+++ b/lib/Archive/Zip/Member.pm
@@ -6,7 +6,7 @@ use strict;
 use vars qw( $VERSION @ISA );
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
     @ISA     = qw( Archive::Zip );
 
     if ($^O eq 'MSWin32') {
@@ -1086,6 +1086,7 @@ sub _writeData {
         my ($outRef, $status) = $self->readChunk($chunkSize);
         symlink $$outRef, $self->{'newName'};
     } else {
+        return AZ_OK if ($self->uncompressedSize() == 0);
         my $status;
         my $chunkSize = $Archive::Zip::ChunkSize;
         while ($self->_readDataRemaining() > 0) {
diff --git a/lib/Archive/Zip/MemberRead.pm b/lib/Archive/Zip/MemberRead.pm
index 3f56e84..56ca4f1 100644
--- a/lib/Archive/Zip/MemberRead.pm
+++ b/lib/Archive/Zip/MemberRead.pm
@@ -40,7 +40,7 @@ use vars qw{$VERSION};
 my $nl;
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
     $VERSION = eval $VERSION;
 
 # Requirement for newline conversion. Should check for e.g., DOS and OS/2 as 
well, but am too lazy.
diff --git a/lib/Archive/Zip/MockFileHandle.pm 
b/lib/Archive/Zip/MockFileHandle.pm
index 4417867..106c536 100644
--- a/lib/Archive/Zip/MockFileHandle.pm
+++ b/lib/Archive/Zip/MockFileHandle.pm
@@ -10,7 +10,7 @@ use strict;
 use vars qw{$VERSION};
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
     $VERSION = eval $VERSION;
 }
 
diff --git a/lib/Archive/Zip/NewFileMember.pm b/lib/Archive/Zip/NewFileMember.pm
index 871d040..264136e 100644
--- a/lib/Archive/Zip/NewFileMember.pm
+++ b/lib/Archive/Zip/NewFileMember.pm
@@ -4,7 +4,7 @@ use strict;
 use vars qw( $VERSION @ISA );
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
     @ISA     = qw ( Archive::Zip::FileMember );
 }
 
diff --git a/lib/Archive/Zip/StringMember.pm b/lib/Archive/Zip/StringMember.pm
index 2312dd7..2b5bffc 100644
--- a/lib/Archive/Zip/StringMember.pm
+++ b/lib/Archive/Zip/StringMember.pm
@@ -4,7 +4,7 @@ use strict;
 use vars qw( $VERSION @ISA );
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
     @ISA     = qw( Archive::Zip::Member );
 }
 
diff --git a/lib/Archive/Zip/Tree.pm b/lib/Archive/Zip/Tree.pm
index cb50b22..f2db246 100644
--- a/lib/Archive/Zip/Tree.pm
+++ b/lib/Archive/Zip/Tree.pm
@@ -4,7 +4,7 @@ use strict;
 use vars qw{$VERSION};
 
 BEGIN {
-       $VERSION = '1.46';
+       $VERSION = '1.47';
 }
 
 use Archive::Zip;
diff --git a/lib/Archive/Zip/ZipFileMember.pm b/lib/Archive/Zip/ZipFileMember.pm
index 0ac7f78..e57722c 100644
--- a/lib/Archive/Zip/ZipFileMember.pm
+++ b/lib/Archive/Zip/ZipFileMember.pm
@@ -4,7 +4,7 @@ use strict;
 use vars qw( $VERSION @ISA );
 
 BEGIN {
-    $VERSION = '1.46';
+    $VERSION = '1.47';
     @ISA     = qw ( Archive::Zip::FileMember );
 }
 
diff --git a/t/20_bug_github11.t b/t/20_bug_github11.t
new file mode 100644
index 0000000..5bad5bd
--- /dev/null
+++ b/t/20_bug_github11.t
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+
+# Github 11: "CRC or size mismatch" when extracting member second time
+# Test for correct functionality to prevent regression
+
+use strict;
+use warnings;
+
+use Archive::Zip qw( :ERROR_CODES );
+use File::Spec;
+use File::Path;
+use t::common;
+
+use Test::More tests => 2;
+
+# create test env
+my $GH_ISSUE   = 'github11';
+my $TEST_NAME  = "20_bug_$GH_ISSUE";
+my $TEST_DIR   = File::Spec->catdir(TESTDIR, $TEST_NAME);
+mkpath($TEST_DIR);
+
+# test 1
+my $DATA_DIR      = File::Spec->catfile('t', 'data');
+my $GOOD_ZIP_FILE = File::Spec->catfile($DATA_DIR, "good_${GH_ISSUE}.zip");
+my $GOOD_ZIP      = Archive::Zip->new($GOOD_ZIP_FILE);
+my $MEMBER_FILE = 'FILE';
+my $member      = $GOOD_ZIP->memberNamed($MEMBER_FILE);
+my $OUT_FILE = File::Spec->catfile($TEST_DIR, "out");
+# Extracting twice triggered the bug
+$member->extractToFileNamed($OUT_FILE);
+is($member->extractToFileNamed($OUT_FILE), AZ_OK, 'Testing known good zip');
+
+# test 2
+my $BAD_ZIP_FILE = File::Spec->catfile($DATA_DIR, "bad_${GH_ISSUE}.zip");
+my $BAD_ZIP      = Archive::Zip->new($BAD_ZIP_FILE);
+$member = $BAD_ZIP->memberNamed($MEMBER_FILE);
+# Extracting twice triggered the bug
+$member->extractToFileNamed($OUT_FILE);
+is($member->extractToFileNamed($OUT_FILE), AZ_OK, 'Testing known bad zip');
diff --git a/t/21_zip64.t b/t/21_zip64.t
new file mode 100644
index 0000000..f337db8
--- /dev/null
+++ b/t/21_zip64.t
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+# Test to make sure zip64 files are properly detected
+
+use strict;
+use warnings;
+
+use Archive::Zip qw( :ERROR_CODES );
+use File::Spec;
+use t::common;
+
+use Test::More tests => 1;
+
+my $DATA_DIR = File::Spec->catfile('t', 'data');
+my $ZIP_FILE = File::Spec->catfile($DATA_DIR, "zip64.zip");
+
+my @errors = ();
+$Archive::Zip::ErrorHandler = sub { push @errors, @_ };
+eval { Archive::Zip->new($ZIP_FILE) };
+ok($errors[0] =~ /zip64 not supported/, 'Got expected zip64 error');
diff --git a/t/22_deflated_dir.t b/t/22_deflated_dir.t
new file mode 100644
index 0000000..1239b17
--- /dev/null
+++ b/t/22_deflated_dir.t
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Archive::Zip qw( :ERROR_CODES );
+use File::Spec;
+use t::common;
+
+use Test::More tests => 4;
+
+my $zip = Archive::Zip->new();
+isa_ok( $zip, 'Archive::Zip' );
+is( $zip->read(File::Spec->catfile('t', 'data', 'jar.zip')), AZ_OK, 'Read 
file' );
+
+my $ret = eval { $zip->writeToFileNamed(OUTPUTZIP) };
+
+is($ret, AZ_OK, 'Wrote file');
+
+my ($status, $zipout) = testZip();
+# STDERR->print("status= $status, out=$zipout\n");
+skip( "test zip doesn't work", 1 ) if $testZipDoesntWork;
+is( $status, 0, "output zip isn't corrupted" );
diff --git a/t/data/bad_github11.zip b/t/data/bad_github11.zip
new file mode 100644
index 0000000..3fe4892
Binary files /dev/null and b/t/data/bad_github11.zip differ
diff --git a/t/data/good_github11.zip b/t/data/good_github11.zip
new file mode 100644
index 0000000..39ee392
Binary files /dev/null and b/t/data/good_github11.zip differ
diff --git a/t/data/jar.zip b/t/data/jar.zip
new file mode 100644
index 0000000..a8da50f
Binary files /dev/null and b/t/data/jar.zip differ
diff --git a/t/data/zip64.zip b/t/data/zip64.zip
new file mode 100644
index 0000000..a2ee1fa
Binary files /dev/null and b/t/data/zip64.zip differ

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libarchive-zip-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to