diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/File-Glob/Glob.xs | 1 | ||||
-rw-r--r-- | ext/File-Glob/t/rt114984.t | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/ext/File-Glob/Glob.xs b/ext/File-Glob/Glob.xs index 3ea05909c6..d74e7a4965 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 0000000000..4229c6b780 --- /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+@mp, + 'File::Glob extends the stack when returning a long list'; |