[Reproducible-commits] [strip-nondeterminism] 03/03: Correct the max number of bytes we read when copying PNG chunk data

Chris Lamb chris at chris-lamb.co.uk
Tue Jul 19 16:32:25 UTC 2016


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

lamby pushed a commit to branch master
in repository strip-nondeterminism.

commit dfd1d3b8f586234e36a3438708493f1ca1203aaa
Author: Chris Lamb <lamby at debian.org>
Date:   Tue Jul 19 18:30:17 2016 +0200

    Correct the max number of bytes we read when copying PNG chunk data
---
 lib/File/StripNondeterminism/handlers/png.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/File/StripNondeterminism/handlers/png.pm b/lib/File/StripNondeterminism/handlers/png.pm
index 7fd0d7c..a76e304 100644
--- a/lib/File/StripNondeterminism/handlers/png.pm
+++ b/lib/File/StripNondeterminism/handlers/png.pm
@@ -25,6 +25,7 @@ use warnings;
 use File::Basename qw/dirname/;
 use POSIX qw/strftime/;
 use Archive::Zip;
+use List::Util qw/min/;
 
 sub crc {
 	my ($data) = @_;
@@ -112,7 +113,7 @@ sub _normalize {
 
 		while ($len > 0) {
 			# Can't trust $len so read data part in chunks
-			$bytes_read = read($fh, $buf, 4096);
+			$bytes_read = read($fh, $buf, min($len, 4096));
 
 			if ($bytes_read == 0) {
 				warn "$filename: invalid length in $type header";

-- 
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