summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-09 18:51:46 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-09 18:51:46 +0000
commitf55b10c001fd492604b926fc6e60fd072727726c (patch)
treefd0ae979c44725fea504d174fcd52aba25bdb71a /string.c
parenteb5789e2ac699a04d34f27fafb342f2a78832e5a (diff)
* string.c (rb_str_index): if t == s + pos, the character beginning
from s + pos is valid. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 053db6cbb5..53c4027923 100644
--- a/string.c
+++ b/string.c
@@ -2074,7 +2074,7 @@ rb_str_index(VALUE str, VALUE sub, long offset)
pos = rb_memsearch(sptr, slen, s, len);
if (pos < 0) return pos;
t = rb_enc_right_char_head(s, s+pos, enc);
- if (t == s) break;
+ if (t == s + pos) break;
if ((len -= t - s) <= 0) return -1;
offset += t - s;
s = t;