Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=618fb6ac18491ac7dd5f9b49f9657e7b093a5a07

commit 618fb6ac18491ac7dd5f9b49f9657e7b093a5a07
Author: kikadf <[email protected]>
Date:   Thu Feb 13 10:38:05 2014 +0100

perl-5.14.1-6-x86_64

* Fix CVE-2012-5526, CVE-2012-6329, CVE-2013-1667

diff --git a/source/base/perl/CVE-2012-5526.patch 
b/source/base/perl/CVE-2012-5526.patch
new file mode 100644
index 0000000..1e3a562
--- /dev/null
+++ b/source/base/perl/CVE-2012-5526.patch
@@ -0,0 +1,65 @@
+From: Ryo Anazawa <[email protected]>
+Date: Wed, 14 Nov 2012 09:47:32 +0900
+Subject: [PATCH 1/4] CR escaping for P3P header
+
+Index: perl-5.14.2/cpan/CGI/lib/CGI.pm
+===================================================================
+--- perl-5.14.2.orig/cpan/CGI/lib/CGI.pm       2012-11-16 14:53:37.000000000 
-0800
++++ perl-5.14.2/cpan/CGI/lib/CGI.pm    2012-11-16 14:53:37.000000000 -0800
+@@ -1550,8 +1550,17 @@
+                             'EXPIRES','NPH','CHARSET',
+                             'ATTACHMENT','P3P'],@p);
+
++    # Since $cookie and $p3p may be array references,
++    # we must stringify them before CR escaping is done.
++    my @cookie;
++    for (ref($cookie) eq 'ARRAY' ? @{$cookie} : $cookie) {
++        my $cs = UNIVERSAL::isa($_,'CGI::Cookie') ? $_->as_string : $_;
++        push(@cookie,$cs) if defined $cs and $cs ne '';
++    }
++    $p3p = join ' ',@$p3p if ref($p3p) eq 'ARRAY';
++
+     # CR escaping for values, per RFC 822
+-    for my $header 
($type,$status,$cookie,$target,$expires,$nph,$charset,$attachment,$p3p,@other) {
++    for my $header 
($type,$status,@cookie,$target,$expires,$nph,$charset,$attachment,$p3p,@other) {
+         if (defined $header) {
+             # From RFC 822:
+             # Unfolding  is  accomplished  by regarding   CRLF   immediately
+@@ -1595,18 +1604,9 @@
+
+     push(@header,"Status: $status") if $status;
+     push(@header,"Window-Target: $target") if $target;
+-    if ($p3p) {
+-       $p3p = join ' ',@$p3p if ref($p3p) eq 'ARRAY';
+-       push(@header,qq(P3P: policyref="/w3c/p3p.xml", CP="$p3p"));
+-    }
++    push(@header,"P3P: policyref=\"/w3c/p3p.xml\", CP=\"$p3p\"") if $p3p;
+     # push all the cookies -- there may be several
+-    if ($cookie) {
+-      my(@cookie) = ref($cookie) && ref($cookie) eq 'ARRAY' ? @{$cookie} : 
$cookie;
+-      for (@cookie) {
+-            my $cs = UNIVERSAL::isa($_,'CGI::Cookie') ? $_->as_string : $_;
+-          push(@header,"Set-Cookie: $cs") if $cs ne '';
+-      }
+-    }
++    push(@header,map {"Set-Cookie: $_"} @cookie);
+     # if the user indicates an expiration time, then we need
+     # both an Expires and a Date header (so that the browser is
+     # uses OUR clock)
+Index: perl-5.14.2/cpan/CGI/t/headers.t
+===================================================================
+--- perl-5.14.2.orig/cpan/CGI/t/headers.t      2012-11-16 14:52:33.000000000 
-0800
++++ perl-5.14.2/cpan/CGI/t/headers.t   2012-11-16 14:53:37.000000000 -0800
+@@ -22,6 +22,12 @@
+ like $cgi->header( -type => "text/html".$CGI::CRLF." evil: stuff " ),
+     qr#Content-Type: text/html evil: stuff#, 'known header, with leading and 
trailing whitespace on the continuation line';
+
++eval { $cgi->header( -p3p => ["foo".$CGI::CRLF."bar"] ) };
++like($@,qr/contains a newline/,'P3P header with CRLF embedded blows up');
++
++eval { $cgi->header( -cookie => ["foo".$CGI::CRLF."bar"] ) };
++like($@,qr/contains a newline/,'Set-Cookie header with CRLF embedded blows 
up');
++
+ eval { $cgi->header( -foobar => "text/html".$CGI::CRLF."evil: stuff" ) };
+ like($@,qr/contains a newline/,'unknown header with CRLF embedded blows up');
+
diff --git a/source/base/perl/CVE-2012-6329.patch 
b/source/base/perl/CVE-2012-6329.patch
new file mode 100644
index 0000000..19b66f9
--- /dev/null
+++ b/source/base/perl/CVE-2012-6329.patch
@@ -0,0 +1,54 @@
+Description: fix arbitrary command execution via _compile function in 
Maketext.pm
+Origin: backport, 
http://perl5.git.perl.org/perl.git/commit/1735f6f53ca19f99c6e9e39496c486af323ba6a8
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695224
+
+Index: perl-5.14.2/dist/Locale-Maketext/lib/Locale/Maketext.pm
+===================================================================
+--- perl-5.14.2.orig/dist/Locale-Maketext/lib/Locale/Maketext.pm       
2011-09-19 09:18:22.000000000 -0400
++++ perl-5.14.2/dist/Locale-Maketext/lib/Locale/Maketext.pm    2014-02-04 
15:54:01.434100335 -0500
+@@ -625,21 +625,9 @@
+                         # 0-length method name means to just interpolate:
+                         push @code, ' (';
+                     }
+-                    elsif($m =~ /^\w+(?:\:\:\w+)*$/s
+-                            and $m !~ m/(?:^|\:)\d/s
+-                        # exclude starting a (sub)package or symbol with a 
digit
++                    elsif($m =~ /^\w+$/s
++                        # exclude anything fancy, especially fully-qualified 
module names
+                     ) {
+-                        # Yes, it even supports the demented (and 
undocumented?)
+-                        #  $obj->Foo::bar(...) syntax.
+-                        $target->_die_pointing(
+-                            $string_to_compile, q{Can't use "SUPER::" in a 
bracket-group method},
+-                            2 + length($c[-1])
+-                        )
+-                        if $m =~ m/^SUPER::/s;
+-                        # Because for SUPER:: to work, we'd have to compile 
this into
+-                        #  the right package, and that seems just not worth 
the bother,
+-                        #  unless someone convinces me otherwise.
+-
+                         push @code, ' $_[0]->' . $m . '(';
+                     }
+                     else {
+@@ -693,7 +681,9 @@
+             elsif(substr($1,0,1) ne '~') {
+                 # it's stuff not containing "~" or "[" or "]"
+                 # i.e., a literal blob
+-                $c[-1] .= $1;
++                my $text = $1;
++                $text =~ s/\\/\\\\/g;
++                $c[-1] .= $text;
+
+             }
+             elsif($1 eq '~~') { # "~~"
+@@ -731,7 +721,9 @@
+             else {
+                 # It's a "~X" where X is not a special character.
+                 # Consider it a literal ~ and X.
+-                $c[-1] .= $1;
++                my $text = $1;
++                $text =~ s/\\/\\\\/g;
++                $c[-1] .= $text;
+             }
+         }
+     }
diff --git a/source/base/perl/CVE-2013-1667.patch 
b/source/base/perl/CVE-2013-1667.patch
new file mode 100644
index 0000000..5391296
--- /dev/null
+++ b/source/base/perl/CVE-2013-1667.patch
@@ -0,0 +1,171 @@
+From d59e31fc729d8a39a774f03bc6bc457029a7aef2 Mon Sep 17 00:00:00 2001
+From: Yves Orton <[email protected]>
+Date: Tue, 12 Feb 2013 10:53:05 +0100
+Subject: [PATCH] Prevent premature hsplit() calls, and only trigger REHASH 
after hsplit()
+
+Triggering a hsplit due to long chain length allows an attacker
+to create a carefully chosen set of keys which can cause the hash
+to use 2 * (2**32) * sizeof(void *) bytes ram. AKA a DOS via memory
+exhaustion. Doing so also takes non trivial time.
+
+Eliminating this check, and only inspecting chain length after a
+normal hsplit() (triggered when keys>buckets) prevents the attack
+entirely, and makes such attacks relatively benign.
+
+(cherry picked from commit f1220d61455253b170e81427c9d0357831ca0fac)
+---
+ ext/Hash-Util-FieldHash/t/10_hash.t |   18 ++++++++++++++++--
+ hv.c                                |   35 ++++++++---------------------------
+ t/op/hash.t                         |   20 +++++++++++++++++---
+ 3 files changed, 41 insertions(+), 32 deletions(-)
+
+diff --git a/ext/Hash-Util-FieldHash/t/10_hash.t 
b/ext/Hash-Util-FieldHash/t/10_hash.t
+index 2cfb4e8..d58f053 100644
+--- a/ext/Hash-Util-FieldHash/t/10_hash.t
++++ b/ext/Hash-Util-FieldHash/t/10_hash.t
+@@ -38,15 +38,29 @@ use constant START     => "a";
+
+ # some initial hash data
+ fieldhash my %h2;
+-%h2 = map {$_ => 1} 'a'..'cc';
++my $counter= "a";
++$h2{$counter++}++ while $counter ne 'cd';
+
+ ok (!Internals::HvREHASH(%h2),
+     "starting with pre-populated non-pathological hash (rehash flag if off)");
+
+ my @keys = get_keys(\%h2);
++my $buckets= buckets(\%h2);
+ $h2{$_}++ for @keys;
++$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
+ ok (Internals::HvREHASH(%h2),
+-    scalar(@keys) . " colliding into the same bucket keys are triggering 
rehash");
++    scalar(@keys) . " colliding into the same bucket keys are triggering 
rehash after split");
++
++# returns the number of buckets in a hash
++sub buckets {
++    my $hr = shift;
++    my $keys_buckets= scalar(%$hr);
++    if ($keys_buckets=~m!/([0-9]+)\z!) {
++        return 0+$1;
++    } else {
++        return 8;
++    }
++}
+
+ sub get_keys {
+     my $hr = shift;
+diff --git a/hv.c b/hv.c
+index 2be1feb..abb9d76 100644
+--- a/hv.c
++++ b/hv.c
+@@ -35,7 +35,8 @@ holds the key and hash value.
+ #define PERL_HASH_INTERNAL_ACCESS
+ #include "perl.h"
+
+-#define HV_MAX_LENGTH_BEFORE_SPLIT 14
++#define HV_MAX_LENGTH_BEFORE_REHASH 14
++#define SHOULD_DO_HSPLIT(xhv) ((xhv)->xhv_keys > (xhv)->xhv_max) /* 
HvTOTALKEYS(hv) > HvMAX(hv) */
+
+ static const char S_strtab_error[]
+     = "Cannot modify shared string table in hv_%s";
+@@ -794,29 +795,9 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, 
STRLEN klen,
+     if (masked_flags & HVhek_ENABLEHVKFLAGS)
+       HvHASKFLAGS_on(hv);
+
+-    {
+-      const HE *counter = HeNEXT(entry);
+-
+-      xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
+-      if (!counter) {                         /* initial entry? */
+-      } else if (xhv->xhv_keys > xhv->xhv_max) {
+-              /* Use only the old HvKEYS(hv) > HvMAX(hv) condition to limit
+-                 bucket splits on a rehashed hash, as we're not going to
+-                 split it again, and if someone is lucky (evil) enough to
+-                 get all the keys in one list they could exhaust our memory
+-                 as we repeatedly double the number of buckets on every
+-                 entry. Linear search feels a less worse thing to do.  */
+-          hsplit(hv);
+-      } else if(!HvREHASH(hv)) {
+-          U32 n_links = 1;
+-
+-          while ((counter = HeNEXT(counter)))
+-              n_links++;
+-
+-          if (n_links > HV_MAX_LENGTH_BEFORE_SPLIT) {
+-              hsplit(hv);
+-          }
+-      }
++    xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
++    if ( SHOULD_DO_HSPLIT(xhv) ) {
++        hsplit(hv);
+     }
+
+     if (return_svp) {
+@@ -1192,7 +1173,7 @@ S_hsplit(pTHX_ HV *hv)
+
+
+     /* Pick your policy for "hashing isn't working" here:  */
+-    if (longest_chain <= HV_MAX_LENGTH_BEFORE_SPLIT /* split worked?  */
++    if (longest_chain <= HV_MAX_LENGTH_BEFORE_REHASH /* split worked?  */
+       || HvREHASH(hv)) {
+       return;
+     }
+@@ -2831,8 +2812,8 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, 
register U32 hash, int flags)
+
+       xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
+       if (!next) {                    /* initial entry? */
+-      } else if (xhv->xhv_keys > xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
+-              hsplit(PL_strtab);
++      } else if ( SHOULD_DO_HSPLIT(xhv) ) {
++            hsplit(PL_strtab);
+       }
+     }
+
+diff --git a/t/op/hash.t b/t/op/hash.t
+index 278bea7..201260a 100644
+--- a/t/op/hash.t
++++ b/t/op/hash.t
+@@ -39,22 +39,36 @@ use constant THRESHOLD => 14;
+ use constant START     => "a";
+
+ # some initial hash data
+-my %h2 = map {$_ => 1} 'a'..'cc';
++my %h2;
++my $counter= "a";
++$h2{$counter++}++ while $counter ne 'cd';
+
+ ok (!Internals::HvREHASH(%h2),
+     "starting with pre-populated non-pathological hash (rehash flag if off)");
+
+ my @keys = get_keys(\%h2);
++my $buckets= buckets(\%h2);
+ $h2{$_}++ for @keys;
++$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
+ ok (Internals::HvREHASH(%h2),
+-    scalar(@keys) . " colliding into the same bucket keys are triggering 
rehash");
++    scalar(@keys) . " colliding into the same bucket keys are triggering 
rehash after split");
++
++# returns the number of buckets in a hash
++sub buckets {
++    my $hr = shift;
++    my $keys_buckets= scalar(%$hr);
++    if ($keys_buckets=~m!/([0-9]+)\z!) {
++        return 0+$1;
++    } else {
++        return 8;
++    }
++}
+
+ sub get_keys {
+     my $hr = shift;
+
+     # the minimum of bits required to mount the attack on a hash
+     my $min_bits = log(THRESHOLD)/log(2);
+-
+     # if the hash has already been populated with a significant amount
+     # of entries the number of mask bits can be higher
+     my $keys = scalar keys %$hr;
+--
+1.7.4.1
+
diff --git a/source/base/perl/FrugalBuild b/source/base/perl/FrugalBuild
index 4a0b51c..de11d98 100644
--- a/source/base/perl/FrugalBuild
+++ b/source/base/perl/FrugalBuild
@@ -4,7 +4,7 @@

pkgname=perl
pkgver=5.14.1
-pkgrel=5
+pkgrel=6
pkgdesc="Practical Extraction and Report Language."
url="http://www.perl.org/";
rodepends=('scriptlet-core')
@@ -31,6 +31,13 @@ source=(http://www.cpan.org/src/5.0/$pkgname-$pkgver.tar.gz \
sha1sums=('bd24b7572330c4f87a47ea841f88deb925245a8b' \
'92179e28215bf7b802ded72e0ca6e473a21f5003')

+# FSA fix ***
+source=(${source[@]} CVE-2012-5526.patch CVE-2012-6329.patch 
CVE-2013-1667.patch)
+sha1sums=(${sha1sums[@]} '1a259bbc517e3d499aeb229cf6eb9372844cdd0d' \
+                         'dc256eb6ecd9cfac34547697628db01a42f119bf' \
+                         'd705cf17aab02a3af372e28a4c78c1382e917187')
+# ***********
+
build() {
unset MAKEFLAGS
Fcd
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to