This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
eliminate RExC_seen_evals and RExC_rx->seen_evals
authorDavid Mitchell <davem@iabyn.com>
Sun, 1 Apr 2012 12:22:14 +0000 (13:22 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 13 Jun 2012 12:32:51 +0000 (13:32 +0100)
these were used as part of the old "use re 'eval'" security
mechanism used by the now-eliminated PL_reginterp_cnt

dump.c
ext/Devel-Peek/t/Peek.t
regcomp.c
regexp.h

diff --git a/dump.c b/dump.c
index ce33864..0dffb35 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -2052,8 +2052,6 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
                                (UV)(r->gofs));
            Perl_dump_indent(aTHX_ level, file, "  PRE_PREFIX = %"UVuf"\n",
                                (UV)(r->pre_prefix));
-           Perl_dump_indent(aTHX_ level, file, "  SEEN_EVALS = %"UVuf"\n",
-                               (UV)(r->seen_evals));
            Perl_dump_indent(aTHX_ level, file, "  SUBLEN = %"IVdf"\n",
                                (IV)(r->sublen));
            if (r->subbeg)
index 534c6d7..2b5f6aa 100644 (file)
@@ -349,7 +349,6 @@ do_test('reference to regexp',
     MINLENRET = 3
     GOFS = 0
     PRE_PREFIX = 4
-    SEEN_EVALS = 0
     SUBLEN = 0
     SUBBEG = 0x0
     ENGINE = $ADDR
index fc13f9d..42fedf4 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -133,7 +133,6 @@ typedef struct RExC_state_t {
     I32                nestroot;               /* root parens we are in - used by accept */
     I32                extralen;
     I32                seen_zerolen;
-    I32                seen_evals;
     regnode    **open_parens;          /* pointers to open parens */
     regnode    **close_parens;         /* pointers to close parens */
     regnode    *opend;                 /* END node in program */
@@ -194,7 +193,6 @@ typedef struct RExC_state_t {
 #define RExC_nestroot   (pRExC_state->nestroot)
 #define RExC_extralen  (pRExC_state->extralen)
 #define RExC_seen_zerolen      (pRExC_state->seen_zerolen)
-#define RExC_seen_evals        (pRExC_state->seen_evals)
 #define RExC_utf8      (pRExC_state->utf8)
 #define RExC_uni_semantics     (pRExC_state->uni_semantics)
 #define RExC_orig_utf8 (pRExC_state->orig_utf8)
@@ -5715,7 +5713,6 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
     RExC_seen = 0;
     RExC_in_lookbehind = 0;
     RExC_seen_zerolen = *exp == '^' ? -1 : 0;
-    RExC_seen_evals = 0;
     RExC_extralen = 0;
     RExC_override_recoding = 0;
 
@@ -5916,8 +5913,6 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
     RExC_emit_bound = ri->program + RExC_size + 1;
     pRExC_state->code_index = 0;
 
-    /* Store the count of eval-groups for security checks: */
-    RExC_rx->seen_evals = RExC_seen_evals;
     REGC((U8)REG_MAGIC, (char*) RExC_emit++);
     if (reg(pRExC_state, 0, &flags,1) == NULL) {
        ReREFCNT_dec(rx);   
@@ -8592,9 +8587,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                /* this is a pre-compiled code block (?{...}) */
                cb = &pRExC_state->code_blocks[pRExC_state->code_index];
                RExC_parse = RExC_start + cb->end;
-               if (SIZE_ONLY)
-                   RExC_seen_evals++;
-               else {
+               if (!SIZE_ONLY) {
                    OP *o = cb->block;
                    if (cb->src_regex) {
                        n = add_data(pRExC_state, 2, "rl");
index 8a77122..df038a6 100644 (file)
--- a/regexp.h
+++ b/regexp.h
@@ -118,8 +118,6 @@ struct reg_code_block {
        /* Information about the match that isn't often used */         \
        /* offset from wrapped to the start of precomp */               \
        PERL_BITFIELD32 pre_prefix:4;                                   \
-       /* number of eval groups in the pattern - for security checks */\
-       PERL_BITFIELD32 seen_evals:28;                                  \
        CV *qr_anoncv   /* the anon sub wrapped round qr/(?{..})/ */
 
 typedef struct regexp {
@@ -492,7 +490,6 @@ get_regex_charset_name(const U32 flags, STRLEN* const lenp)
 #define RX_GOFS(prog)          (((struct regexp *)SvANY(prog))->gofs)
 #define RX_LASTPAREN(prog)     (((struct regexp *)SvANY(prog))->lastparen)
 #define RX_LASTCLOSEPAREN(prog)        (((struct regexp *)SvANY(prog))->lastcloseparen)
-#define RX_SEEN_EVALS(prog)    (((struct regexp *)SvANY(prog))->seen_evals)
 #define RX_SAVED_COPY(prog)    (((struct regexp *)SvANY(prog))->saved_copy)
 
 #endif /* PLUGGABLE_RE_EXTENSION */