summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-07 06:59:46 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-07 06:59:46 +0000
commit6fc752bf7da30898ff8e570f9354cab9419cf3cf (patch)
tree69ef1c65eafc080502ce7cb838a7d8a34904980e /regex.c
parenta509e67c5a690ad83bde66299d73bcf967f84dc1 (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/regex.c b/regex.c
index 5ab57418aa..307b6af1aa 100644
--- a/regex.c
+++ b/regex.c
@@ -3137,7 +3137,7 @@ re_search(bufp, string, size, startpos, range, regs)
/* If the search isn't to be a backwards one, don't waste time in a
search for a pattern that must be anchored. */
- if (bufp->used>0) {
+ if (bufp->used > 0) {
switch ((enum regexpcode)bufp->buffer[0]) {
case begbuf:
begbuf_match:
@@ -3196,6 +3196,7 @@ re_search(bufp, string, size, startpos, range, regs)
if (range > 0 && (bufp->options & RE_OPTIMIZE_EXACTN)) {
startpos += pos;
range -= pos;
+ if (range < 0) return -1;
}
}