diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-14 08:30:54 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-14 08:30:54 +0000 |
commit | 6a3931e0f630f56d4acd2b232f58c0225f03f52b (patch) | |
tree | fe8a957b8513962866aa7beefb4ffc5498a70a4a /string.c | |
parent | 9681409e3691037c11c19052295616454f74c936 (diff) | |
download | ruby-6a3931e0f630f56d4acd2b232f58c0225f03f52b.tar.gz |
Check pos and strlen on Regexp#index(str, pos) [ruby-core:23660]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -2569,6 +2569,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)); |