diff options
author | Tony Cook <tony@develop-help.com> | 2014-01-30 15:00:11 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2014-01-30 15:00:11 +1100 |
commit | e4c0574e9d9f5b2e6ba1562b7db7381075cf619c (patch) | |
tree | 1b81f60d2460699184230401705a961cdc5d9790 /ext | |
parent | 59100ba95cd44a06c460d63e262e2d291b35e721 (diff) | |
download | perl-e4c0574e9d9f5b2e6ba1562b7db7381075cf619c.tar.gz |
ensure we have a reference when we call SvRV()
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Devel-Peek/Peek.pm | 2 | ||||
-rw-r--r-- | ext/Devel-Peek/Peek.xs | 3 | ||||
-rw-r--r-- | ext/Devel-Peek/t/Peek.t | 1 |
3 files changed, 5 insertions, 1 deletions
diff --git a/ext/Devel-Peek/Peek.pm b/ext/Devel-Peek/Peek.pm index 7f811e1b28..731dc11117 100644 --- a/ext/Devel-Peek/Peek.pm +++ b/ext/Devel-Peek/Peek.pm @@ -3,7 +3,7 @@ package Devel::Peek; -$VERSION = '1.15'; +$VERSION = '1.16'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/ext/Devel-Peek/Peek.xs b/ext/Devel-Peek/Peek.xs index ef77830a33..679efa5d06 100644 --- a/ext/Devel-Peek/Peek.xs +++ b/ext/Devel-Peek/Peek.xs @@ -492,6 +492,9 @@ SvREFCNT(sv) SV * sv PROTOTYPE: \[$@%&*] CODE: + SvGETMAGIC(sv); + if (!SvROK(sv)) + croak_xs_usage(cv, "SCALAR"); RETVAL = SvREFCNT(SvRV(sv)) - 1; /* -1 because our ref doesn't count */ OUTPUT: RETVAL diff --git a/ext/Devel-Peek/t/Peek.t b/ext/Devel-Peek/t/Peek.t index 80a6fb06ba..dbc988304d 100644 --- a/ext/Devel-Peek/t/Peek.t +++ b/ext/Devel-Peek/t/Peek.t @@ -1268,6 +1268,7 @@ do_test('UTF-8 in a regular expression', my $base_count = Devel::Peek::SvREFCNT(%hash); my $ref = \%hash; is(Devel::Peek::SvREFCNT(%hash), $base_count + 1, "SvREFCNT on non-scalar"); + ok(!eval { &Devel::Peek::SvREFCNT(1) }, "requires prototype"); } { # utf8 tests |