summaryrefslogtreecommitdiffstats
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
commitf23f4f6e63b16d443855dde1fd19ed8c5a18960e (patch)
tree69ef1c65eafc080502ce7cb838a7d8a34904980e /regex.c
parentb0f42632a2ced3c1249f06c7d09004009c5cd22f (diff)
downloadruby-f23f4f6e63b16d443855dde1fd19ed8c5a18960e.tar.gz
ruby-f23f4f6e63b16d443855dde1fd19ed8c5a18960e.tar.xz
ruby-f23f4f6e63b16d443855dde1fd19ed8c5a18960e.zip
matz
git-svn-id: http://svn.ruby-lang.org/repos/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 5ab57418a..307b6af1a 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;
}
}