This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp.c: Restore uninit warning to study
authorFather Chrysostomos <sprout@cpan.org>
Wed, 27 Jun 2012 19:41:56 +0000 (12:41 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 27 Jun 2012 19:41:56 +0000 (12:41 -0700)
Also, prevent a crash when SvCUR is used on a non-PV.

pp.c

diff --git a/pp.c b/pp.c
index c7d1841..1742baa 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -652,7 +652,7 @@ PP(pp_study)
     dVAR; dSP; dPOPss;
     STRLEN len;
 
-    len = SvCUR(sv);
+    (void)SvPV(sv, len);
     if (len == 0 || len > I32_MAX || !SvPOK(sv) || SvUTF8(sv) || SvVALID(sv)) {
        /* Historically, study was skipped in these cases. */
        RETPUSHNO;