This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix crash with ‘join,’ caused by 987c96916
authorFather Chrysostomos <sprout@cpan.org>
Sun, 19 Oct 2014 18:06:48 +0000 (11:06 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 19 Oct 2014 18:12:25 +0000 (11:12 -0700)
op.c
t/lib/croak/op

diff --git a/op.c b/op.c
index e28cc54..47d02ef 100644 (file)
--- a/op.c
+++ b/op.c
@@ -10643,10 +10643,11 @@ Perl_ck_join(pTHX_ OP *o)
                        SVfARG(msg), SVfARG(msg));
        }
     }
-    if (kid->op_type == OP_CONST  /* an innocent, unsuspicious separator */
-     || (kid->op_type == OP_PADSV && !(kid->op_private & OPpLVAL_INTRO))
-     || (kid->op_type==OP_RV2SV && kUNOP->op_first->op_type == OP_GV
-       && !(kid->op_private & (OPpLVAL_INTRO|OPpOUR_INTRO))))
+    if (kid
+     && (kid->op_type == OP_CONST /* an innocent, unsuspicious separator */
+       || (kid->op_type == OP_PADSV && !(kid->op_private & OPpLVAL_INTRO))
+       || (  kid->op_type==OP_RV2SV && kUNOP->op_first->op_type == OP_GV
+          && !(kid->op_private & (OPpLVAL_INTRO|OPpOUR_INTRO)))))
     {
        const OP * const bairn = OP_SIBLING(kid); /* the list */
        if (bairn && !OP_HAS_SIBLING(bairn) /* single-item list */
index 8be9b12..d85ef73 100644 (file)
@@ -1,4 +1,10 @@
 __END__
+# NAME join,
+join,
+EXPECT
+Not enough arguments for join or string at - line 1, near "join,"
+Execution of - aborted due to compilation errors.
+########
 # NAME my $<special>
 my $!;
 EXPECT