summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-11-22 21:28:15 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-11-22 21:29:35 -0800
commitbc4eb4d6f895e86a4afbc016eae943c7546c35f2 (patch)
treeef18a6108892dffc3ebf5c7bdc667133a2b37b4f /util.c
parenta3f353cf7aaf90ddfb021a9733ff75f4437d4e70 (diff)
downloadperl-bc4eb4d6f895e86a4afbc016eae943c7546c35f2.tar.gz
[perl #102586] version->new("version") SEGVs
This adds an ROK check after calling sv_derived_from, as the latter also works for class names. It is done after sv_derived_from, rather than before, as sv_derived_from calls get-magic.
Diffstat (limited to 'util.c')
-rw-r--r--util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util.c b/util.c
index 8b2e5f54c9..4a170aa24b 100644
--- a/util.c
+++ b/util.c
@@ -4857,7 +4857,8 @@ Perl_new_version(pTHX_ SV *ver)
dVAR;
SV * const rv = newSV(0);
PERL_ARGS_ASSERT_NEW_VERSION;
- if ( sv_derived_from(ver,"version") ) /* can just copy directly */
+ if ( sv_derived_from(ver,"version") && SvROK(ver) )
+ /* can just copy directly */
{
I32 key;
AV * const av = newAV();