This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The CHECKOP macro was not invoked on some newly created ops
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 8 Jul 2003 20:26:20 +0000 (20:26 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 8 Jul 2003 20:26:20 +0000 (20:26 +0000)
(to match them against the current opmask.) As a consequence,
Safe compartments were unable to trap some ops (pattern
match, slices, conditionals.) This fixes the holes.

p4raw-id: //depot/perl@20079

op.c

diff --git a/op.c b/op.c
index 70f5160..304cf46 100644 (file)
--- a/op.c
+++ b/op.c
@@ -2174,7 +2174,7 @@ Perl_newLISTOP(pTHX_ I32 type, I32 flags, OP *first, OP *last)
            listop->op_last = pushop;
     }
 
-    return (OP*)listop;
+    return CHECKOP(type, listop);
 }
 
 OP *
@@ -2611,7 +2611,7 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags)
        PmopSTASH_set(pmop,PL_curstash);
     }
 
-    return (OP*)pmop;
+    return CHECKOP(type, pmop);
 }
 
 OP *
@@ -3417,6 +3417,8 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp)
     first->op_next = (OP*)logop;
     first->op_sibling = other;
 
+    CHECKOP(type,logop);
+
     o = newUNOP(OP_NULL, 0, (OP*)logop);
     other->op_next = o;
 
@@ -3461,6 +3463,8 @@ Perl_newCONDOP(pTHX_ I32 flags, OP *first, OP *trueop, OP *falseop)
     logop->op_other = LINKLIST(trueop);
     logop->op_next = LINKLIST(falseop);
 
+    CHECKOP(OP_COND_EXPR, /* that's logop->op_type */
+           logop);
 
     /* establish postfix order */
     start = LINKLIST(first);