From 271738ffe9d8ec2b4700c585a9322322b2c6cb16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
Date: Thu, 3 Nov 2016 14:58:16 +0100
Subject: Fix stack handling when calling chdir without an argument

---
 ...30-make-chdir-allocate-the-stack-it-needs.patch | 66 ++++++++++++++++++++++
 perl.spec                                          |  6 ++
 2 files changed, 72 insertions(+)
 create mode 100644 
perl-5.22.2-perl-129130-make-chdir-allocate-the-stack-it-needs.patch

diff --git 
a/perl-5.22.2-perl-129130-make-chdir-allocate-the-stack-it-needs.patch 
b/perl-5.22.2-perl-129130-make-chdir-allocate-the-stack-it-needs.patch
new file mode 100644
index 0000000..90488e3
--- /dev/null
+++ b/perl-5.22.2-perl-129130-make-chdir-allocate-the-stack-it-needs.patch
@@ -0,0 +1,66 @@
+From 36dc786e5ea4a6d3e85f1f55251b8538fabb8321 Mon Sep 17 00:00:00 2001
+From: Tony Cook <t...@develop-help.com>
+Date: Mon, 5 Sep 2016 15:40:11 +1000
+Subject: [PATCH] (perl #129130) make chdir allocate the stack it needs
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Ported to 5.22.2:
+
+commit 92c843fb4b4e1a1e0ac7ec0fe198dc77266838da
+Author: Tony Cook <t...@develop-help.com>
+Date:   Mon Sep 5 15:40:11 2016 +1000
+
+    (perl #129130) make chdir allocate the stack it needs
+
+    chdir with no argument didn't ensure there was stack space available
+    for its result.
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ pp_sys.c     | 1 +
+ t/op/chdir.t | 8 +++++++-
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/pp_sys.c b/pp_sys.c
+index 1285c75..2171a1a 100644
+--- a/pp_sys.c
++++ b/pp_sys.c
+@@ -3580,6 +3580,7 @@ PP(pp_chdir)
+       HV * const table = GvHVn(PL_envgv);
+       SV **svp;
+ 
++        EXTEND(SP, 1);
+         if (    (svp = hv_fetchs(table, "HOME", FALSE))
+              || (svp = hv_fetchs(table, "LOGDIR", FALSE))
+ #ifdef VMS
+diff --git a/t/op/chdir.t b/t/op/chdir.t
+index 813b0ed..f16be41 100644
+--- a/t/op/chdir.t
++++ b/t/op/chdir.t
+@@ -10,7 +10,7 @@ BEGIN {
+     # possibilities into @INC.
+     unshift @INC, qw(t . lib ../lib);
+     require "./test.pl";
+-    plan(tests => 48);
++    plan(tests => 49);
+ }
+ 
+ use Config;
+@@ -176,6 +176,12 @@ WARNING
+     }
+ }
+ 
++fresh_perl_is(<<'EOP', '', { stderr => 1 }, "check stack handling");
++for $x (map $_+1, 1 .. 100) {
++  map chdir, 1 .. $x;
++}
++EOP
++
+ my %Saved_Env = ();
+ sub clean_env {
+     foreach my $env (@magic_envs) {
+-- 
+2.7.4
+
diff --git a/perl.spec b/perl.spec
index adbb7c9..e0d4209 100644
--- a/perl.spec
+++ b/perl.spec
@@ -143,6 +143,9 @@ Patch45:        
perl-5.22.2-regcomp.c-fix-perl-129950-fix-firstchar-bitmap-under
 # RT#130001, in upstream after 5.25.6
 Patch46:        
perl-5.25.6-perl-130001-h2xs-avoid-infinite-loop-for-enums.patch
 
+# Fix stack handling when calling chdir without an argument, RT#129130
+Patch47:        
perl-5.22.2-perl-129130-make-chdir-allocate-the-stack-it-needs.patch
+
 # Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
 Patch200:       
perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
 
@@ -2202,6 +2205,7 @@ Perl extension for Version Objects
 %patch44 -p1
 %patch45 -p1
 %patch46 -p1
+%patch47 -p1
 %patch200 -p1
 %patch201 -p1
 
@@ -2240,6 +2244,7 @@ perl -x patchlevel.h \
     'Fedora Patch44: Fix parsing perl options in shell bang line (RT#129336)' \
     'Fedora Patch45: Fix firstchar bitmap under UTF-8 with prefix optimization 
(RT#129950)' \
     'Fedora Patch46: Avoid infinite loop in h2xs tool if enum and type have 
the same name (RT130001)' \
+    'Fedora Patch47: Fix stack handling when calling chdir without an argument 
(RT#129130)' \
     'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on 
Linux' \
     'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
     %{nil}
@@ -4264,6 +4269,7 @@ popd
 - Fix firstchar bitmap under UTF-8 with prefix optimization (RT#129950)
 - Avoid infinite loop in h2xs tool if enum and type have the same name
   (RT130001)
+- Fix stack handling when calling chdir without an argument (RT#129130)
 
 * Wed Aug 03 2016 Jitka Plesnikova <jples...@redhat.com> - 4:5.22.2-354
 - Avoid loading optional modules from default . (CVE-2016-1238)
-- 
cgit v0.12


        
http://pkgs.fedoraproject.org/cgit/perl.git/commit/?h=f23&id=271738ffe9d8ec2b4700c585a9322322b2c6cb16
_______________________________________________
perl-devel mailing list -- perl-devel@lists.fedoraproject.org
To unsubscribe send an email to perl-devel-le...@lists.fedoraproject.org

Reply via email to