Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 619787 Details for
Bug 849703
Regular Expression matching in signal handler causes side-effects
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch which maintains binary compatiblity
perl-5.14.2-kill.patch (text/plain), 16.36 KB, created by
Mark Phillips
on 2012-10-01 13:25:19 UTC
(
hide
)
Description:
Patch which maintains binary compatiblity
Filename:
MIME Type:
Creator:
Mark Phillips
Created:
2012-10-01 13:25:19 UTC
Size:
16.36 KB
patch
obsolete
>diff -ur perl-5.14.2.orig/embed.fnc perl-5.14.2/embed.fnc >--- perl-5.14.2.orig/embed.fnc 2011-09-26 10:44:34.000000000 +0100 >+++ perl-5.14.2/embed.fnc 2012-09-25 11:33:50.459083508 +0100 >@@ -1862,7 +1862,7 @@ > ERs |bool |reginclass |NULLOK const regexp * const prog|NN const regnode * const n|NN const U8 * const p|NULLOK STRLEN *lenp\ > |bool const do_utf8sv_is_utf8 > Es |CHECKPOINT|regcppush |I32 parenfloor >-Es |char* |regcppop |NN const regexp *rex >+Es |char* |regcppop |NN regexp *rex > ERsn |U8* |reghop3 |NN U8 *s|I32 off|NN const U8 *lim > #ifdef XXX_dmq > ERsn |U8* |reghop4 |NN U8 *s|I32 off|NN const U8 *llim \ >diff -ur perl-5.14.2.orig/proto.h perl-5.14.2/proto.h >--- perl-5.14.2.orig/proto.h 2011-09-26 10:44:34.000000000 +0100 >+++ perl-5.14.2/proto.h 2012-09-25 10:49:23.418716467 +0100 >@@ -6245,7 +6245,7 @@ > #define PERL_ARGS_ASSERT_REG_CHECK_NAMED_BUFF_MATCHED \ > assert(rex); assert(scan) > >-STATIC char* S_regcppop(pTHX_ const regexp *rex) >+STATIC char* S_regcppop(pTHX_ regexp *rex) > __attribute__nonnull__(pTHX_1); > #define PERL_ARGS_ASSERT_REGCPPOP \ > assert(rex) >diff -ur perl-5.14.2.orig/regexec.c perl-5.14.2/regexec.c >--- perl-5.14.2.orig/regexec.c 2011-09-26 10:44:34.000000000 +0100 >+++ perl-5.14.2/regexec.c 2012-09-25 11:13:18.672575209 +0100 >@@ -389,7 +389,7 @@ > regcpblow(cp) > > STATIC char * >-S_regcppop(pTHX_ const regexp *rex) >+S_regcppop(pTHX_ regexp *rex) > { > dVAR; > UV i; >@@ -403,8 +403,10 @@ > assert((i & SAVE_MASK) == SAVEt_REGCONTEXT); /* Check that the magic cookie is there. */ > i >>= SAVE_TIGHT_SHIFT; /* Parentheses elements to pop. */ > input = (char *) SSPOPPTR; >- *PL_reglastcloseparen = SSPOPINT; >- *PL_reglastparen = SSPOPINT; >+ rex->lastcloseparen = SSPOPINT; >+ PL_reglastcloseparen = &rex->lastcloseparen; >+ rex->lastparen = SSPOPINT; >+ PL_reglastparen = &rex->lastparen; > PL_regsize = SSPOPINT; > PL_regoffs=(regexp_paren_pair *) SSPOPPTR; > >@@ -414,24 +416,24 @@ > I32 tmps; > U32 paren = (U32)SSPOPINT; > PL_reg_start_tmp[paren] = (char *) SSPOPPTR; >- PL_regoffs[paren].start = SSPOPINT; >+ rex->offs[paren].start = SSPOPINT; > tmps = SSPOPINT; >- if (paren <= *PL_reglastparen) >- PL_regoffs[paren].end = tmps; >+ if (paren <= rex->lastparen) >+ rex->offs[paren].end = tmps; > DEBUG_BUFFERS_r( > PerlIO_printf(Perl_debug_log, > " restoring \\%"UVuf" to %"IVdf"(%"IVdf")..%"IVdf"%s\n", >- (UV)paren, (IV)PL_regoffs[paren].start, >+ (UV)paren, (IV)rex->offs[paren].start, > (IV)(PL_reg_start_tmp[paren] - PL_bostr), >- (IV)PL_regoffs[paren].end, >- (paren > *PL_reglastparen ? "(no)" : "")); >+ (IV)rex->offs[paren].end, >+ (paren > rex->lastparen ? "(no)" : "")); > ); > } > DEBUG_BUFFERS_r( >- if (*PL_reglastparen + 1 <= rex->nparens) { >+ if (rex->lastparen + 1 <= rex->nparens) { > PerlIO_printf(Perl_debug_log, > " restoring \\%"IVdf"..\\%"IVdf" to undef\n", >- (IV)(*PL_reglastparen + 1), (IV)rex->nparens); >+ (IV)(rex->lastparen + 1), (IV)rex->nparens); > } > ); > #if 1 >@@ -444,10 +446,10 @@ > * this code seems to be necessary or otherwise > * this erroneously leaves $1 defined: "1" =~ /^(?:(\d)x)?\d$/ > * --jhi updated by dapm */ >- for (i = *PL_reglastparen + 1; i <= rex->nparens; i++) { >+ for (i = rex->lastparen + 1; i <= rex->nparens; i++) { > if (i > PL_regsize) >- PL_regoffs[i].start = -1; >- PL_regoffs[i].end = -1; >+ rex->offs[i].start = -1; >+ rex->offs[i].end = -1; > } > #endif > return input; >@@ -2608,9 +2610,9 @@ > * --jhi updated by dapm */ > #if 1 > if (prog->nparens) { >- regexp_paren_pair *pp = PL_regoffs; >+ regexp_paren_pair *pp = prog->offs; > register I32 i; >- for (i = prog->nparens; i > (I32)*PL_reglastparen; i--) { >+ for (i = prog->nparens; i > (I32)prog->lastparen; i--) { > ++pp; > pp->start = -1; > pp->end = -1; >@@ -2619,7 +2621,7 @@ > #endif > REGCP_SET(lastcp); > if (regmatch(reginfo, progi->program + 1)) { >- PL_regoffs[0].end = PL_reginput - PL_bostr; >+ prog->offs[0].end = PL_reginput - PL_bostr; > return 1; > } > if (reginfo->cutpoint) >@@ -2955,8 +2957,8 @@ > PERL_ARGS_ASSERT_REG_CHECK_NAMED_BUFF_MATCHED; > > for ( n=0; n<SvIVX(sv_dat); n++ ) { >- if ((I32)*PL_reglastparen >= nums[n] && >- PL_regoffs[nums[n]].end != -1) >+ if ((I32)rex->lastparen >= nums[n] && >+ rex->offs[nums[n]].end != -1) > { > return nums[n]; > } >@@ -3132,14 +3134,14 @@ > > case KEEPS: > /* update the startpoint */ >- st->u.keeper.val = PL_regoffs[0].start; >+ st->u.keeper.val = rex->offs[0].start; > PL_reginput = locinput; >- PL_regoffs[0].start = locinput - PL_bostr; >+ rex->offs[0].start = locinput - PL_bostr; > PUSH_STATE_GOTO(KEEPS_next, next); > /*NOT-REACHED*/ > case KEEPS_next_fail: > /* rollback the start point change */ >- PL_regoffs[0].start = st->u.keeper.val; >+ rex->offs[0].start = st->u.keeper.val; > sayNO_SILENT; > /*NOT-REACHED*/ > case EOL: >@@ -3397,9 +3399,9 @@ > case TRIE_next_fail: /* we failed - try next alternative */ > if ( ST.jump) { > REGCP_UNWIND(ST.cp); >- for (n = *PL_reglastparen; n > ST.lastparen; n--) >- PL_regoffs[n].end = -1; >- *PL_reglastparen = n; >+ for (n = rex->lastparen; n > ST.lastparen; n--) >+ rex->offs[n].end = -1; >+ rex->lastparen = n; > } > if (!--ST.accepted) { > DEBUG_EXECUTE_r({ >@@ -3433,7 +3435,7 @@ > } > > if ( ST.jump) { >- ST.lastparen = *PL_reglastparen; >+ ST.lastparen = rex->lastparen; > REGCP_SET(ST.cp); > } > >@@ -4074,11 +4076,11 @@ > n = ARG(scan); /* which paren pair */ > > do_nref_ref_common: >- ln = PL_regoffs[n].start; >+ ln = rex->offs[n].start; > PL_reg_leftiter = PL_reg_maxiter; /* Void cache */ >- if (*PL_reglastparen < n || ln == -1) >+ if (rex->lastparen < n || ln == -1) > sayNO; /* Do not match unless seen CLOSEn. */ >- if (ln == PL_regoffs[n].end) >+ if (ln == rex->offs[n].end) > break; > > s = PL_bostr + ln; >@@ -4092,7 +4094,7 @@ > * not going off the end given by PL_regeol, and returns in > * limit upon success, how much of the current input was > * matched */ >- if (! foldEQ_utf8_flags(s, NULL, PL_regoffs[n].end - ln, utf8_target, >+ if (! foldEQ_utf8_flags(s, NULL, rex->offs[n].end - ln, utf8_target, > locinput, &limit, 0, utf8_target, utf8_fold_flags)) > { > sayNO; >@@ -4107,7 +4109,7 @@ > (type == REF || > UCHARAT(s) != fold_array[nextchr])) > sayNO; >- ln = PL_regoffs[n].end - ln; >+ ln = rex->offs[n].end - ln; > if (locinput + ln > PL_regeol) > sayNO; > if (ln > 1 && (type == REF >@@ -4196,7 +4198,7 @@ > DEBUG_STATE_r( PerlIO_printf(Perl_debug_log, > " re_eval 0x%"UVxf"\n", PTR2UV(PL_op)) ); > PAD_SAVE_LOCAL(old_comppad, (PAD*)rexi->data->data[n + 2]); >- PL_regoffs[0].end = PL_reg_magic->mg_len = locinput - PL_bostr; >+ rex->offs[0].end = PL_reg_magic->mg_len = locinput - PL_bostr; > > if (sv_yes_mark) { > SV *sv_mrk = get_sv("REGMARK", 1); >@@ -4318,14 +4320,13 @@ > > eval_recurse_doit: /* Share code with GOSUB below this line */ > /* run the pattern returned from (??{...}) */ >+ >+ PL_reglastcloseparen = &rex->lastcloseparen; >+ PL_reglastparen = &rex->lastparen; > ST.cp = regcppush(0); /* Save *all* the positions. */ > REGCP_SET(ST.lastcp); > >- PL_regoffs = re->offs; /* essentially NOOP on GOSUB */ >- > /* see regtry, specifically PL_reglast(?:close)?paren is a pointer! (i dont know why) :dmq */ >- PL_reglastparen = &re->lastparen; >- PL_reglastcloseparen = &re->lastcloseparen; > re->lastparen = 0; > re->lastcloseparen = 0; > >@@ -4372,12 +4373,6 @@ > cur_eval = ST.prev_eval; > cur_curlyx = ST.prev_curlyx; > >- /* rex was changed so update the pointer in PL_reglastparen and PL_reglastcloseparen */ >- PL_reglastparen = &rex->lastparen; >- PL_reglastcloseparen = &rex->lastcloseparen; >- /* also update PL_regoffs */ >- PL_regoffs = rex->offs; >- > /* XXXX This is too dramatic a measure... */ > PL_reg_maxiter = 0; > if ( nochange_depth ) >@@ -4392,9 +4387,6 @@ > SETREX(rex_sv,ST.prev_rex); > rex = (struct regexp *)SvANY(rex_sv); > rexi = RXi_GET(rex); >- /* rex was changed so update the pointer in PL_reglastparen and PL_reglastcloseparen */ >- PL_reglastparen = &rex->lastparen; >- PL_reglastcloseparen = &rex->lastcloseparen; > > PL_reginput = locinput; > REGCP_UNWIND(ST.lastcp); >@@ -4417,13 +4409,13 @@ > break; > case CLOSE: > n = ARG(scan); /* which paren pair */ >- PL_regoffs[n].start = PL_reg_start_tmp[n] - PL_bostr; >- PL_regoffs[n].end = locinput - PL_bostr; >+ rex->offs[n].start = PL_reg_start_tmp[n] - PL_bostr; >+ rex->offs[n].end = locinput - PL_bostr; > /*if (n > PL_regsize) > PL_regsize = n;*/ >- if (n > *PL_reglastparen) >- *PL_reglastparen = n; >- *PL_reglastcloseparen = n; >+ if (n > rex->lastparen) >+ rex->lastparen = n; >+ rex->lastcloseparen = n; > if (cur_eval && cur_eval->u.eval.close_paren == n) { > goto fake_end; > } >@@ -4438,14 +4430,14 @@ > if ( OP(cursor)==CLOSE ){ > n = ARG(cursor); > if ( n <= lastopen ) { >- PL_regoffs[n].start >+ rex->offs[n].start > = PL_reg_start_tmp[n] - PL_bostr; >- PL_regoffs[n].end = locinput - PL_bostr; >+ rex->offs[n].end = locinput - PL_bostr; > /*if (n > PL_regsize) > PL_regsize = n;*/ >- if (n > *PL_reglastparen) >- *PL_reglastparen = n; >- *PL_reglastcloseparen = n; >+ if (n > rex->lastparen) >+ rex->lastparen = n; >+ rex->lastcloseparen = n; > if ( n == ARG(scan) || (cur_eval && > cur_eval->u.eval.close_paren == n)) > break; >@@ -4457,7 +4449,7 @@ > /*NOTREACHED*/ > case GROUPP: > n = ARG(scan); /* which paren pair */ >- sw = cBOOL(*PL_reglastparen >= n && PL_regoffs[n].end != -1); >+ sw = cBOOL(rex->lastparen >= n && rex->offs[n].end != -1); > break; > case NGROUPP: > /* reg_check_named_buff_matched returns 0 for no match */ >@@ -4580,8 +4572,8 @@ > > /* XXXX Probably it is better to teach regpush to support > parenfloor > PL_regsize... */ >- if (parenfloor > (I32)*PL_reglastparen) >- parenfloor = *PL_reglastparen; /* Pessimization... */ >+ if (parenfloor > (I32)rex->lastparen) >+ parenfloor = rex->lastparen; /* Pessimization... */ > > ST.prev_curlyx= cur_curlyx; > cur_curlyx = st; >@@ -4641,6 +4633,8 @@ > /* First just match a string of min A's. */ > > if (n < min) { >+ PL_reglastcloseparen = &rex->lastcloseparen; >+ PL_reglastparen = &rex->lastparen; > ST.cp = regcppush(cur_curlyx->u.curlyx.parenfloor); > cur_curlyx->u.curlyx.lastloc = locinput; > REGCP_SET(ST.lastcp); >@@ -4717,6 +4711,8 @@ > if (cur_curlyx->u.curlyx.minmod) { > ST.save_curlyx = cur_curlyx; > cur_curlyx = cur_curlyx->u.curlyx.prev_curlyx; >+ PL_reglastcloseparen = &rex->lastcloseparen; >+ PL_reglastparen = &rex->lastparen; > ST.cp = regcppush(ST.save_curlyx->u.curlyx.parenfloor); > REGCP_SET(ST.lastcp); > PUSH_YES_STATE_GOTO(WHILEM_B_min, ST.save_curlyx->u.curlyx.B); >@@ -4726,6 +4722,8 @@ > /* Prefer A over B for maximal matching. */ > > if (n < max) { /* More greed allowed? */ >+ PL_reglastcloseparen = &rex->lastcloseparen; >+ PL_reglastparen = &rex->lastparen; > ST.cp = regcppush(cur_curlyx->u.curlyx.parenfloor); > cur_curlyx->u.curlyx.lastloc = locinput; > REGCP_SET(ST.lastcp); >@@ -4811,6 +4809,8 @@ > /* Try grabbing another A and see if it helps. */ > PL_reginput = locinput; > cur_curlyx->u.curlyx.lastloc = locinput; >+ PL_reglastcloseparen = &rex->lastcloseparen; >+ PL_reglastparen = &rex->lastparen; > ST.cp = regcppush(cur_curlyx->u.curlyx.parenfloor); > REGCP_SET(ST.lastcp); > PUSH_STATE_GOTO(WHILEM_A_min, >@@ -4829,7 +4829,7 @@ > > case BRANCH: /* /(...|A|...)/ */ > scan = NEXTOPER(scan); /* scan now points to inner node */ >- ST.lastparen = *PL_reglastparen; >+ ST.lastparen = rex->lastparen; > ST.next_branch = next; > REGCP_SET(ST.cp); > PL_reginput = locinput; >@@ -4863,10 +4863,10 @@ > no_final = 0; > } > REGCP_UNWIND(ST.cp); >- for (n = *PL_reglastparen; n > ST.lastparen; n--) >- PL_regoffs[n].end = -1; >- *PL_reglastparen = n; >- /*dmq: *PL_reglastcloseparen = n; */ >+ for (n = rex->lastparen; n > ST.lastparen; n--) >+ rex->offs[n].end = -1; >+ rex->lastparen = n; >+ /*dmq: rex->lastcloseparen = n; */ > scan = ST.next_branch; > /* no more branches? */ > if (!scan || (OP(scan) != BRANCH && OP(scan) != BRANCHJ)) { >@@ -4905,8 +4905,8 @@ > U32 paren = ST.me->flags; > if (paren > PL_regsize) > PL_regsize = paren; >- if (paren > *PL_reglastparen) >- *PL_reglastparen = paren; >+ if (paren > rex->lastparen) >+ rex->lastparen = paren; > scan += NEXT_OFF(scan); /* Skip former OPEN. */ > } > ST.A = scan; >@@ -5033,13 +5033,13 @@ > /* mark current A as captured */ > I32 paren = ST.me->flags; > if (ST.count) { >- PL_regoffs[paren].start >+ rex->offs[paren].start > = HOPc(PL_reginput, -ST.alen) - PL_bostr; >- PL_regoffs[paren].end = PL_reginput - PL_bostr; >- /*dmq: *PL_reglastcloseparen = paren; */ >+ rex->offs[paren].end = PL_reginput - PL_bostr; >+ /*dmq: rex->lastcloseparen = paren; */ > } > else >- PL_regoffs[paren].end = -1; >+ rex->offs[paren].end = -1; > if (cur_eval && cur_eval->u.eval.close_paren && > cur_eval->u.eval.close_paren == (U32)ST.me->flags) > { >@@ -5074,12 +5074,12 @@ > #define CURLY_SETPAREN(paren, success) \ > if (paren) { \ > if (success) { \ >- PL_regoffs[paren].start = HOPc(locinput, -1) - PL_bostr; \ >- PL_regoffs[paren].end = locinput - PL_bostr; \ >- *PL_reglastcloseparen = paren; \ >+ rex->offs[paren].start = HOPc(locinput, -1) - PL_bostr; \ >+ rex->offs[paren].end = locinput - PL_bostr; \ >+ rex->lastcloseparen = paren; \ > } \ > else \ >- PL_regoffs[paren].end = -1; \ >+ rex->offs[paren].end = -1; \ > } > > case STAR: /* /A*B/ where A is width 1 */ >@@ -5098,8 +5098,8 @@ > ST.paren = scan->flags; /* Which paren to set */ > if (ST.paren > PL_regsize) > PL_regsize = ST.paren; >- if (ST.paren > *PL_reglastparen) >- *PL_reglastparen = ST.paren; >+ if (ST.paren > rex->lastparen) >+ rex->lastparen = ST.paren; > ST.min = ARG1(scan); /* min to match */ > ST.max = ARG2(scan); /* max to match */ > if (cur_eval && cur_eval->u.eval.close_paren && >@@ -5255,7 +5255,7 @@ > case CURLY_B_min_known_fail: > /* failed to find B in a non-greedy match where c1,c2 valid */ > if (ST.paren && ST.count) >- PL_regoffs[ST.paren].end = -1; >+ rex->offs[ST.paren].end = -1; > > PL_reginput = locinput; /* Could be reset... */ > REGCP_UNWIND(ST.cp); >@@ -5333,7 +5333,7 @@ > case CURLY_B_min_fail: > /* failed to find B in a non-greedy match where c1,c2 invalid */ > if (ST.paren && ST.count) >- PL_regoffs[ST.paren].end = -1; >+ rex->offs[ST.paren].end = -1; > > REGCP_UNWIND(ST.cp); > /* failed -- move forward one */ >@@ -5380,7 +5380,7 @@ > case CURLY_B_max_fail: > /* failed to find B in a greedy match */ > if (ST.paren && ST.count) >- PL_regoffs[ST.paren].end = -1; >+ rex->offs[ST.paren].end = -1; > > REGCP_UNWIND(ST.cp); > /* back up. */ >@@ -5401,16 +5401,14 @@ > PL_reg_flags ^= st->u.eval.toggle_reg_flags; > > st->u.eval.prev_rex = rex_sv; /* inner */ >+ PL_reglastcloseparen = &rex->lastcloseparen; >+ PL_reglastparen = &rex->lastparen; >+ st->u.eval.cp = regcppush(0); /* Save *all* the positions. */ > SETREX(rex_sv,cur_eval->u.eval.prev_rex); > rex = (struct regexp *)SvANY(rex_sv); > rexi = RXi_GET(rex); > cur_curlyx = cur_eval->u.eval.prev_curlyx; > (void)ReREFCNT_inc(rex_sv); >- st->u.eval.cp = regcppush(0); /* Save *all* the positions. */ >- >- /* rex was changed so update the pointer in PL_reglastparen and PL_reglastcloseparen */ >- PL_reglastparen = &rex->lastparen; >- PL_reglastcloseparen = &rex->lastcloseparen; > > REGCP_SET(st->u.eval.lastcp); > PL_reginput = locinput;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 849703
:
619787
|
746137