In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/d80618d26460a93181dddc9ec53c3fceef864290?hp=b7bfa855cd96849c1ce8b7e9624b69c94149aacc>
- Log ----------------------------------------------------------------- commit d80618d26460a93181dddc9ec53c3fceef864290 Author: Craig A. Berry <[email protected]> Date: Sat Jul 25 14:06:34 2009 -0500 Save and restore PL_regeol for op inside of regex (RT ##66110) If the op inside of a (?{ }) construct is another regex, the two regexen end up corrupting each others' end-of-string markers, resulting in various pathologies including access violations, stack corruptions, and memory use growing without bound. The change here is intended to be a relatively safe, cheap way to prevent memory errors and makes no attempt to save and restore other aspects of regex state; i.e., general purpose reentrancy for the regex engine is still a TODO. ----------------------------------------------------------------------- Summary of changes: regexec.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/regexec.c b/regexec.c index f3c9540..d3dd612 100644 --- a/regexec.c +++ b/regexec.c @@ -3716,6 +3716,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog) OP_4tree * const oop = PL_op; COP * const ocurcop = PL_curcop; PAD *old_comppad; + char *saved_regeol = PL_regeol; n = ARG(scan); PL_op = (OP_4tree*)rexi->data->data[n]; @@ -3741,6 +3742,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog) PL_op = oop; PAD_RESTORE_LOCAL(old_comppad); PL_curcop = ocurcop; + PL_regeol = saved_regeol; if (!logical) { /* /(?{...})/ */ sv_setsv(save_scalar(PL_replgv), ret); -- Perl5 Master Repository
