[Reproducible-commits] [strip-nondeterminism] 01/04: Work around bug in Archive::Zip that causes infinite loop

Andrew Ayer agwa at andrewayer.name
Thu Feb 5 22:10:30 UTC 2015


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

agwa-guest pushed a commit to branch debian
in repository strip-nondeterminism.

commit d117f4fe44308103d4a2301df863f82f4042d3e7
Author: Andrew Ayer <agwa at andrewayer.name>
Date:   Thu Feb 5 13:38:29 2015 -0800

    Work around bug in Archive::Zip that causes infinite loop
---
 lib/File/StripNondeterminism/handlers/zip.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/File/StripNondeterminism/handlers/zip.pm b/lib/File/StripNondeterminism/handlers/zip.pm
index 5adcdbb..5b214b8 100644
--- a/lib/File/StripNondeterminism/handlers/zip.pm
+++ b/lib/File/StripNondeterminism/handlers/zip.pm
@@ -33,12 +33,14 @@ use constant SAFE_EPOCH => 315576060;
 # Extract and return the first $nbytes of $member (an Archive::Zip::Member)
 sub peek_member {
 	my ($member, $nbytes) = @_;
+	my $original_size = $member->compressedSize();
 	my $old_compression_method = $member->desiredCompressionMethod(COMPRESSION_STORED);
 	$member->rewindData() == AZ_OK or die "failed to rewind ZIP member";
 	my ($buffer, $status) = $member->readChunk($nbytes);
 	die "failed to read ZIP member" if $status != AZ_OK && $status != AZ_STREAM_END;
 	$member->endRead();
 	$member->desiredCompressionMethod($old_compression_method);
+	$member->{'compressedSize'} = $original_size; # Work around https://github.com/redhotpenguin/perl-Archive-Zip/issues/11
 	return $$buffer;
 }
 
@@ -49,7 +51,9 @@ sub normalize_member {
 	# Extract the member to a temporary file.
 	my $tempdir = File::Temp->newdir();
 	my $filename = "$tempdir/member";
+	my $original_size = $member->compressedSize();
 	$member->extractToFileNamed($filename);
+	$member->{'compressedSize'} = $original_size; # Work around https://github.com/redhotpenguin/perl-Archive-Zip/issues/11
 
 	# Normalize the temporary file.
 	if ($normalizer->($filename)) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/strip-nondeterminism.git



More information about the Reproducible-commits mailing list