diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-09-06 18:07:50 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-09-06 23:25:50 -0700 |
commit | 313efa9019b629125306f4c66c583d70960482b8 (patch) | |
tree | 511fb562efd6688d32b6baaf0591db3be5405566 /ext/Devel-Peek | |
parent | 958c98f0f80fcd212653c42fe408bb6d9eb1f6d0 (diff) | |
download | perl-313efa9019b629125306f4c66c583d70960482b8.tar.gz |
Stop Devel'Peek'Dump with no args from crashing
I accidentally broke this in commit xxxxxxxx (5.19.3). The crash hap-
pened at compile time.
Diffstat (limited to 'ext/Devel-Peek')
-rw-r--r-- | ext/Devel-Peek/Peek.xs | 7 | ||||
-rw-r--r-- | ext/Devel-Peek/t/Peek.t | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/ext/Devel-Peek/Peek.xs b/ext/Devel-Peek/Peek.xs index 73094b8efc..91b7555841 100644 --- a/ext/Devel-Peek/Peek.xs +++ b/ext/Devel-Peek/Peek.xs @@ -389,6 +389,13 @@ S_ck_dump(pTHX_ OP *entersubop, GV *namegv, SV *cv) prev = aop; aop = aop->op_sibling; } + if (!aop) { + /* It doesn’t really matter what we return here, as this only + occurs after yyerror. */ + op_free(first); + return entersubop; + } + /* aop now points to the second arg if there is one, the cvop otherwise */ if (aop->op_sibling) { diff --git a/ext/Devel-Peek/t/Peek.t b/ext/Devel-Peek/t/Peek.t index 929ce79b4a..7025b45b38 100644 --- a/ext/Devel-Peek/t/Peek.t +++ b/ext/Devel-Peek/t/Peek.t @@ -1039,6 +1039,12 @@ SV = PV\($ADDR\) at $ADDR LEN = \d+ SUBSTR +# Dump with no arguments +eval 'Dump'; +like $@, qr/^Not enough arguments for Devel::Peek::Dump/, 'Dump;'; +eval 'Dump()'; +like $@, qr/^Not enough arguments for Devel::Peek::Dump/, 'Dump()'; + SKIP: { skip "Not built with usemymalloc", 2 unless $Config{usemymalloc} eq 'y'; |