summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorJan-Pieter Cornet <johnpc@xs4all.nl>1998-07-31 14:44:57 +0200
committerGurusamy Sarathy <gsar@cpan.org>1998-08-02 04:41:43 +0000
commit19b4f81ab32719bedc893a7532029fff0bf316c9 (patch)
treeb53a2a0aeddeb1fb45653d221c91f44bea0927bc /regexec.c
parent6087ac4414f58a8f56f41d3b670cd75f7a5e6936 (diff)
downloadperl-19b4f81ab32719bedc893a7532029fff0bf316c9.tar.gz
de-utf-ized variation of Ilya's patch
Message-ID: <6ps779$hmj$1@xs1.xs4all.nl> Subject: Re: s/\s*$//g in majordomo causes segfault under 5.005_01 p4raw-id: //depot/maint-5.005/perl@1693
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/regexec.c b/regexec.c
index 47ece6a14b..13675cc9e3 100644
--- a/regexec.c
+++ b/regexec.c
@@ -619,10 +619,13 @@ regexec_flags(register regexp *prog, char *stringarg, register char *strend,
} else {
STRLEN len;
char *little = SvPV(prog->float_substr, len);
- last = rninstr(s, strend, little, little + len);
+ if (len)
+ last = rninstr(s, strend, little, little + len);
+ else
+ last = strend; /* matching `$' */
}
if (last == NULL) goto phooey; /* Should not happen! */
- dontbother = strend - last - 1;
+ dontbother = strend - last + prog->float_min_offset;
}
if (minlen && (dontbother < minlen))
dontbother = minlen - 1;
@@ -638,9 +641,8 @@ regexec_flags(register regexp *prog, char *stringarg, register char *strend,
goto phooey;
got_it:
- strend += dontbother; /* uncheat */
prog->subbeg = strbeg;
- prog->subend = strend;
+ prog->subend = PL_regeol; /* strend may have been modified */
RX_MATCH_TAINTED_set(prog, PL_reg_flags & RF_tainted);
/* make sure $`, $&, $', and $digit will work later */
@@ -652,7 +654,7 @@ got_it:
}
}
else {
- I32 i = strend - startpos + (stringarg - strbeg);
+ I32 i = PL_regeol - startpos + (stringarg - strbeg);
s = savepvn(strbeg, i);
Safefree(prog->subbase);
prog->subbase = s;