summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1998-06-21 00:27:16 -0400
committerGurusamy Sarathy <gsar@cpan.org>1998-06-22 00:59:28 +0000
commit7e5428c5eadf5068dae305575a105bd61a84cb5d (patch)
tree6f1c67cd5b099917f7e0c67463e1b5b37d518c12 /regexec.c
parent274c75005985b277dc1c9506e79e73f65d8cd586 (diff)
downloadperl-7e5428c5eadf5068dae305575a105bd61a84cb5d.tar.gz
Zero-length matching bug
Message-Id: <199806210827.EAA26322@monk.mps.ohio-state.edu> p4raw-id: //depot/perl@1185
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/regexec.c b/regexec.c
index b6d2ca4ff4..dd51bc1e22 100644
--- a/regexec.c
+++ b/regexec.c
@@ -697,7 +697,7 @@ regtry(regexp *prog, char *startpos)
}
}
REGCP_SET;
- if (regmatch(prog->program + 1) && reginput >= regtill) {
+ if (regmatch(prog->program + 1)) {
prog->startp[0] = startpos;
prog->endp[0] = reginput;
return 1;
@@ -1504,8 +1504,11 @@ regmatch(regnode *prog)
}
sayNO;
break;
- case SUCCEED:
case END:
+ if (locinput < regtill)
+ sayNO; /* Cannot match: too short. */
+ /* Fall through */
+ case SUCCEED:
reginput = locinput; /* put where regtry can find it */
sayYES; /* Success! */
case SUSPEND: