This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
$ perl5.6.2 -MData::Dumper -le' Data::Dumper->Dumpxs([*{*STDERR{IO}}])'
authorFather Chrysostomos <sprout@cpan.org>
Sun, 26 Sep 2010 21:28:31 +0000 (14:28 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 26 Sep 2010 21:28:31 +0000 (14:28 -0700)
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.

dist/Data-Dumper/Dumper.xs
dist/Data-Dumper/t/bugs.t

index 52a57f8..7845962 100644 (file)
@@ -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;
index cf2803f..3c5d141 100644 (file)
@@ -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