summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-15 12:01:14 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-15 12:01:14 +0000
commit18eff087dab3b67ca740d0c08705ada93e7edcb0 (patch)
tree36b09802f056e454259b7ae03af719a676def910 /string.c
parent0d8ac23d2a2b03932c5e222c5209d1e1eb9d1947 (diff)
merges r24103 from trunk into ruby_1_9_1.
-- Check pos and strlen on Regexp#index(str, pos) [ruby-core:23660] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@24123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/string.c b/string.c
index bf719b8eeb..c27e5d4863 100644
--- a/string.c
+++ b/string.c
@@ -2378,6 +2378,8 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str)
switch (TYPE(sub)) {
case T_REGEXP:
+ if (pos > str_strlen(str, STR_ENC_GET(str)))
+ return Qnil;
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
rb_enc_check(str, sub), single_byte_optimizable(str));