summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-04-24 09:01:40 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-04-24 09:01:40 +0000
commit05b4157f6fee2ece5589511f927d566b229523f9 (patch)
tree440ae27b2ba4044611c795c00fb5ba855662292f /regexec.c
parentceda4f9bd200878375d13c58d9a0b95f9d15724b (diff)
downloadperl-05b4157f6fee2ece5589511f927d566b229523f9.tar.gz
fix RE brokenness on refs/overloaded things (from Ilya Zakharevich)
p4raw-id: //depot/perl@5931
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/regexec.c b/regexec.c
index 3b6d8577a7..8f5278c254 100644
--- a/regexec.c
+++ b/regexec.c
@@ -346,7 +346,9 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
I32 slen;
if ( !(prog->reganch & ROPT_ANCH_GPOS) /* Checked by the caller */
- && (sv && (strpos + SvCUR(sv) != strend)) ) {
+ /* SvCUR is not set on references: SvRV and SvPVX overlap */
+ && sv && !SvROK(sv)
+ && (strpos + SvCUR(sv) != strend)) {
DEBUG_r(PerlIO_printf(Perl_debug_log, "Not at start...\n"));
goto fail;
}
@@ -638,7 +640,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
try_at_start:
/* Even in this situation we may use MBOL flag if strpos is offset
wrt the start of the string. */
- if (ml_anch && sv
+ if (ml_anch && sv && !SvROK(sv) /* See prev comment on SvROK */
&& (strpos + SvCUR(sv) != strend) && strpos[-1] != '\n'
/* May be due to an implicit anchor of m{.*foo} */
&& !(prog->reganch & ROPT_IMPLICIT))