summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2010-08-25 20:05:58 +0200
committerYves Orton <demerphq@gmail.com>2010-08-25 20:06:21 +0200
commitd7d51f4b6ba689e611fef778b3f5d12981e872ba (patch)
tree52e67539e1c0a45573b3ed6293cd3cb664281183 /dump.c
parentb0c6325e9e0a1de42f208a0e41705cc75eb71433 (diff)
downloadperl-d7d51f4b6ba689e611fef778b3f5d12981e872ba.tar.gz
prevent Devel::Peek::Dump from lieing to us about evil class names
While one certainly can argue the merits of using a class name like "\0", it is legal so lets avoid it confusing our primary debugging tool.
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/dump.c b/dump.c
index 06ce87992a..832c60c6c2 100644
--- a/dump.c
+++ b/dump.c
@@ -1434,7 +1434,14 @@ Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, const char *name, HV *sv)
Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv));
if (sv && (hvname = HvNAME_get(sv)))
- PerlIO_printf(file, "\t\"%s\"\n", hvname);
+ {
+ /* we have to use pv_display and HvNAMELEN_get() so that we display the real package
+ name which quite legally could contain insane things like tabs, newlines, nulls or
+ other scary crap - this should produce sane results - except maybe for unicode package
+ names - but we will wait for someone to file a bug on that - demerphq */
+ SV * const tmpsv = newSVpvs("");
+ PerlIO_printf(file, "\t%s\n", pv_display(tmpsv, hvname, HvNAMELEN_get(sv), 0, 1024));
+ }
else
PerlIO_putc(file, '\n');
}