In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/e5c165a0b7551ffb94661aa7f18aabadba257782?hp=3b1d752dd57309cbf5f5018ddf5ec58ce2fcb7a4>

- Log -----------------------------------------------------------------
commit e5c165a0b7551ffb94661aa7f18aabadba257782
Author: Aaron Crane <[email protected]>
Date:   Sun Feb 19 12:26:54 2017 +0000

    [perl #130815] fix ck_return null-pointer deref on malformed code
-----------------------------------------------------------------------

Summary of changes:
 op.c            | 2 +-
 t/comp/parser.t | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/op.c b/op.c
index dca52e2b44..abe32e7e1a 100644
--- a/op.c
+++ b/op.c
@@ -10988,7 +10988,7 @@ Perl_ck_return(pTHX_ OP *o)
     PERL_ARGS_ASSERT_CK_RETURN;
 
     kid = OpSIBLING(cLISTOPo->op_first);
-    if (CvLVALUE(PL_compcv)) {
+    if (PL_compcv && CvLVALUE(PL_compcv)) {
        for (; kid; kid = OpSIBLING(kid))
            op_lvalue(kid, OP_LEAVESUBLV);
     }
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 8be973bfff..570df2e4d5 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -598,6 +598,12 @@ is $@, "", 'substr keys assignment';
     like $@, qr/Missing right curly or square bracket/, 'RT #130311';
 }
 
+# RT #130815: crash in ck_return for malformed code
+{
+    eval 'm(@{if(0){sub d{]]])}return';
+    like $@, qr/^syntax error at \(eval \d+\) line 1, near "\{\]"/,
+        'RT #130815: null pointer deref';
+}
 
 # Add new tests HERE (above this line)
 

--
Perl5 Master Repository

Reply via email to