[libcgi-cookie-splitter-perl] 01/05: Add patch to fix hash randomisation issues.

gregor herrmann gregoa at debian.org
Mon Jan 20 22:06:54 UTC 2014


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

gregoa pushed a commit to branch master
in repository libcgi-cookie-splitter-perl.

commit 202254e12a1b74bbf7b755181cc3ee9062838f6a
Author: gregor herrmann <gregoa at debian.org>
Date:   Mon Jan 20 23:02:54 2014 +0100

    Add patch to fix hash randomisation issues.
    
    Thanks: Shlomi Fish for the patch.
    Closes: #711430
---
 debian/patches/hash-randomisation.patch | 105 ++++++++++++++++++++++++++++++++
 debian/patches/series                   |   1 +
 2 files changed, 106 insertions(+)

diff --git a/debian/patches/hash-randomisation.patch b/debian/patches/hash-randomisation.patch
new file mode 100644
index 0000000..d1602b0
--- /dev/null
+++ b/debian/patches/hash-randomisation.patch
@@ -0,0 +1,105 @@
+Description: fix test failures due to hash randomisation in perl 5.17.6
+Origin: CPAN RT
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=81612
+Bug-Debian: http://bugs.debian.org/711430
+Author: Shlomi Fish
+Reviewed-by: gregor herrmann <gregoa at debian.org>
+Last-Update: 2014-01-20
+
+--- a/lib/CGI/Cookie/Splitter.pm
++++ b/lib/CGI/Cookie/Splitter.pm
+@@ -34,9 +34,11 @@
+ 	my ( $self, $cookie ) = @_;
+ 	return $cookie unless $self->should_split( $cookie );
+ 	return $self->do_split_cookie(
+-		$self->new_cookie( $cookie,
+-			name => $self->mangle_name( $cookie->name, 0 ),
+-			value => CORE::join("&",map { escape($_) } $cookie->value) # simplifies the string splitting
++		scalar(
++			$self->new_cookie( $cookie,
++				name => scalar($self->mangle_name( scalar($cookie->name), 0 )),
++				value => CORE::join("&",map { escape($_) } $cookie->value) # simplifies the string splitting
++			)
+ 		)
+ 	);
+ }
+@@ -44,7 +46,7 @@
+ sub do_split_cookie {
+ 	my ( $self, $head ) = @_;
+ 
+-	my $tail = $self->new_cookie( $head, value => '', name => $self->mangle_name_next( $head->name ) );
++	my $tail = $self->new_cookie( $head, value => '', name => scalar($self->mangle_name_next(scalar( $head->name ))) );
+ 
+ 	my $max_value_size = $self->size - ( $self->cookie_size( $head ) - length( escape($head->value) ) );
+ 	$max_value_size -= 30; # account for overhead the cookie serializer might add
+@@ -101,12 +103,14 @@
+ sub new_cookie {
+ 	my ( $self, $cookie, %params ) = @_;
+ 
++    my %out_params;
+ 	for (qw/name secure path domain expires value/) {
+-		next if exists $params{$_};
+-		$params{"-$_"} = $cookie->$_;
++		$out_params{"-$_"} = (exists($params{$_})
++			? $params{$_} : $cookie->$_
++		);
+ 	}
+ 
+-	blessed($cookie)->new( %params );
++	blessed($cookie)->new( %out_params );
+ }
+ 
+ sub should_split {
+@@ -129,7 +133,7 @@
+ 		}
+ 	}
+ 
+-	foreach my $name ( keys %split ) { 
++	foreach my $name ( sort { $a cmp $b } keys %split ) {
+ 		my $split_cookie = $split{$name};
+ 		croak "The cookie $name is missing some chunks" if grep { !defined } @$split_cookie;
+ 		push @ret, $self->join_cookie( $name => @$split_cookie );
+@@ -140,7 +144,7 @@
+ 
+ sub join_cookie {
+ 	my ( $self, $name, @cookies ) = @_;
+-	$self->new_cookie( $cookies[0], name => $name, value => $self->join_value( map { $_->value } @cookies ) );
++	$self->new_cookie( $cookies[0], name => $name, value => scalar( $self->join_value( map { $_->value } @cookies )) );
+ }
+ 
+ sub join_value {
+@@ -151,12 +155,12 @@
+ sub mangle_name_next {
+ 	my ( $self, $mangled ) = @_;
+ 	my ( $name, $index ) = $self->demangle_name( $mangled );
+-	$self->mangle_name( $name, $index+1 ); # can't trust magic incr because it might overflow and fudge 'chunk'
++	$self->mangle_name( $name, 1 + ((defined($index) ? $index : 0)) ); # can't trust magic incr because it might overflow and fudge 'chunk'
+ }
+ 
+ sub mangle_name {
+ 	my ( $self, $name, $index ) = @_;
+-	return sprintf '_bigcookie_%s_chunk%d', $name, $index;
++	return sprintf '_bigcookie_%s_chunk%d', +(defined($name) ? $name : ''), $index;
+ }
+ 
+ sub demangle_name {
+--- a/t/basic.t
++++ b/t/basic.t
+@@ -60,7 +60,7 @@
+ 		num_cookies => 3,
+ 		cookie => {
+ 			-name => "f",
+-			secure => 1,
++			-secure => 1,
+ 			-value => { foo => ("a" x 1000), bar => ("b" x 1000) },
+ 		},
+ 	},
+@@ -120,7 +120,7 @@
+ 
+ 	while( @all_joined and my($joined, $orig) = ( shift @all_joined, shift @all_cookies ) ) {
+ 		foreach my $field ( qw/name value domain path secure/ ) {
+-			is_deeply( eval { [ $joined->$field ] }, eval { [ $orig->$field ] }, "'$field' is the same" );
++			is_deeply( [ eval { $joined->$field } ], [ eval { $orig->$field } ], "'$field' is the same" );
+ 		}
+ 	}
+ }
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..85e0ec4
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+hash-randomisation.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcgi-cookie-splitter-perl.git



More information about the Pkg-perl-cvs-commits mailing list