summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-09-26 14:28:31 -0700
committerFather Chrysostomos <sprout@cpan.org>2010-09-26 14:28:31 -0700
commitecf0432f1e8289d3b387151b8bf1968133dda7f2 (patch)
tree3e82484a2c552a389c8a9824b313b2b74595ec57 /dist
parentbec4f4b4610b628e92890392df1dcddac6e7b7e8 (diff)
downloadperl-ecf0432f1e8289d3b387151b8bf1968133dda7f2.tar.gz
$ perl5.6.2 -MData::Dumper -le' Data::Dumper->Dumpxs([*{*STDERR{IO}}])'
Bus error Same in 5.11.4. This is related to bug 71254. It turns out that globs *can* stringify emptily (see bug 65582). This patch makes DD more resilient.
Diffstat (limited to 'dist')
-rw-r--r--dist/Data-Dumper/Dumper.xs2
-rw-r--r--dist/Data-Dumper/t/bugs.t7
2 files changed, 7 insertions, 2 deletions
diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs
index 52a57f8c8c..78459624ae 100644
--- a/dist/Data-Dumper/Dumper.xs
+++ b/dist/Data-Dumper/Dumper.xs
@@ -909,7 +909,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
}
else if (realtype == SVt_PVGV) {/* GLOBs can end up with scribbly names */
c = SvPV(val, i);
- ++c; --i; /* just get the name */
+ if(i) ++c, --i; /* just get the name */
if (i >= 6 && strncmp(c, "main::", 6) == 0) {
c += 4;
i -= 4;
diff --git a/dist/Data-Dumper/t/bugs.t b/dist/Data-Dumper/t/bugs.t
index cf2803f900..3c5d141298 100644
--- a/dist/Data-Dumper/t/bugs.t
+++ b/dist/Data-Dumper/t/bugs.t
@@ -12,7 +12,7 @@ BEGIN {
}
use strict;
-use Test::More tests => 5;
+use Test::More tests => 6;
use Data::Dumper;
{
@@ -80,4 +80,9 @@ sub doh
doh('fixed');
ok(1, "[perl #56766]"); # Still no core dump? We are fine.
+# [perl #72332] Segfault on empty-string glob
+Data::Dumper->Dump([*{*STDERR{IO}}]);
+ok("ok", #ok
+ "empty-string glob [perl #72332]");
+
# EOF