[perl] Extend stack in File::Glob::glob

Petr Pisar ppisar at fedoraproject.org
Fri Sep 21 09:41:00 UTC 2012


commit f6b49277f060865f8b76bef577f0ed37adde1c91
Author: Petr Písař <ppisar at redhat.com>
Date:   Fri Sep 21 11:10:19 2012 +0200

    Extend stack in File::Glob::glob

 ...14984-Glob.xs-Extend-stack-when-returning.patch |   76 ++++++++++++++++++++
 perl.spec                                          |    6 ++
 2 files changed, 82 insertions(+), 0 deletions(-)
---
diff --git a/perl-5.16.1-perl-114984-Glob.xs-Extend-stack-when-returning.patch b/perl-5.16.1-perl-114984-Glob.xs-Extend-stack-when-returning.patch
new file mode 100644
index 0000000..64c3e89
--- /dev/null
+++ b/perl-5.16.1-perl-114984-Glob.xs-Extend-stack-when-returning.patch
@@ -0,0 +1,76 @@
+From a6636b43dc409e4b49f369c18fedd34332fdb9ab Mon Sep 17 00:00:00 2001
+From: Father Chrysostomos <sprout at cpan.org>
+Date: Thu, 20 Sep 2012 14:25:38 -0700
+Subject: [PATCH] [perl #114984] Glob.xs: Extend stack when returning
+
+If a pattern passed to File::Glob consists of a space-separated list
+of patterns, the stack will only be extended by doglob() enough for
+the list returned by each subpattern.  So iterate() needs to extend
+the stack before copying the list of files from an AV to the stack.
+
+This fixes a regression introduced in 5.16.0.
+---
+ MANIFEST                   |  1 +
+ ext/File-Glob/Glob.xs      |  1 +
+ ext/File-Glob/t/rt114984.t | 25 +++++++++++++++++++++++++
+ 3 files changed, 27 insertions(+)
+ create mode 100644 ext/File-Glob/t/rt114984.t
+
+diff --git a/MANIFEST b/MANIFEST
+index a7935fc..cceb00e 100644
+--- a/MANIFEST
++++ b/MANIFEST
+@@ -3748,6 +3748,7 @@ ext/File-Glob/t/basic.t		See if File::Glob works
+ ext/File-Glob/t/case.t		See if File::Glob works
+ ext/File-Glob/t/global.t	See if File::Glob works
+ ext/File-Glob/TODO		File::Glob extension todo list
++ext/File-Glob/t/rt114984.t	See if File::Glob works
+ ext/File-Glob/t/taint.t		See if File::Glob works
+ ext/GDBM_File/GDBM_File.pm	GDBM extension Perl module
+ ext/GDBM_File/GDBM_File.xs	GDBM extension external subroutines
+diff --git a/ext/File-Glob/Glob.xs b/ext/File-Glob/Glob.xs
+index 3ea0590..d74e7a4 100644
+--- a/ext/File-Glob/Glob.xs
++++ b/ext/File-Glob/Glob.xs
+@@ -93,6 +93,7 @@ iterate(pTHX_ bool(*globber)(pTHX_ AV *entries, SV *patsv))
+     /* chuck it all out, quick or slow */
+     if (gimme == G_ARRAY) {
+ 	if (!on_stack) {
++	    EXTEND(SP, AvFILLp(entries)+1);
+ 	    Copy(AvARRAY(entries), SP+1, AvFILLp(entries)+1, SV *);
+ 	    SP += AvFILLp(entries)+1;
+ 	}
+diff --git a/ext/File-Glob/t/rt114984.t b/ext/File-Glob/t/rt114984.t
+new file mode 100644
+index 0000000..4229c6b
+--- /dev/null
++++ b/ext/File-Glob/t/rt114984.t
+@@ -0,0 +1,25 @@
++use strict;
++use warnings;
++use v5.16.0;
++use File::Temp 'tempdir';
++use File::Spec::Functions;
++use Test::More tests => 1;
++
++my @md = (1..305);
++my @mp = (1000..1205);
++
++my $path = tempdir uc cleanup => 1;
++
++foreach (@md) {
++    open(my $f, ">", catfile $path, "md_$_.dat");
++    close $f;
++}
++
++foreach (@mp) {
++    open(my $f, ">", catfile $path, "mp_$_.dat");
++    close $f;
++}
++my @b = glob(qq{$path/mp_[0123456789]*.dat
++                $path/md_[0123456789]*.dat});
++is scalar(@b), @md+ at mp,
++    'File::Glob extends the stack when returning a long list';
+-- 
+1.7.11.4
+
diff --git a/perl.spec b/perl.spec
index fd0ee3c..c853e9a 100644
--- a/perl.spec
+++ b/perl.spec
@@ -106,6 +106,9 @@ Patch16:        perl-5.16.1-perl-114764-Stop-my-vars-with-attrs-from-leaking.pat
 # fixed after 5.17.4
 Patch17:        perl-5.16.1-perl-105924-require-1-2.patch
 
+# Extend stack in File::Glob::glob, rhbz#859332, RT#114984, fixed after 5.17.4
+Patch18:        perl-5.16.1-perl-114984-Glob.xs-Extend-stack-when-returning.patch
+
 # Update some of the bundled modules
 # see http://fedoraproject.org/wiki/Perl/perl.spec for instructions
 
@@ -1367,6 +1370,7 @@ tarball from perl.org.
 %patch15 -p1
 %patch16 -p1
 %patch17 -p1
+%patch18 -p1
 
 #copy the example script
 cp -a %{SOURCE5} .
@@ -1576,6 +1580,7 @@ pushd %{build_archlib}/CORE/
     'Fedora Patch15: Override the Pod::Simple::parse_file (CPANRT#77530)' \
     'Fedora Patch16: Do not leak with attribute on my variable (RT#114764)' \
     'Fedora Patch17: Allow operator after numeric keyword argument (RT#105924)' \
+    'Fedora Patch18: Extend stack in File::Glob::glob, (RT#114984)' \
     %{nil}
 
 rm patchlevel.bak
@@ -2723,6 +2728,7 @@ sed \
 * Fri Sep 21 2012 Petr Pisar <ppisar at redhat.com> - 4:5.16.1-238
 - Do not leak with attribute on my variable (bug #858966)
 - Allow operator after numeric keyword argument (bug #859328)
+- Extend stack in File::Glob::glob (bug #859332)
 
 * Thu Sep 20 2012 Petr Pisar <ppisar at redhat.com> - 4:5.16.1-237
 - Put perl-podlators into perl-core list (bug #856516)



More information about the perl-devel mailing list