From 1c32ff927f02f17a0e6cfe6edb375bbd3d309d09 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 20 Dec 2007 00:08:23 +0000 Subject: [PATCH] * string.c (rb_str_index): wrong starting position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ string.c | 1 + 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5801955a65..0b2d36bf09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Dec 20 09:06:54 2007 Yukihiro Matsumoto + + * string.c (rb_str_index): wrong starting position. + Thu Dec 20 06:34:27 2007 Koichi Sasada * compile.c (iseq_compile_each): add pop after throw as return. diff --git a/string.c b/string.c index 5e6e0ae626..f1910af782 100644 --- a/string.c +++ b/string.c @@ -1457,6 +1457,7 @@ rb_str_index(VALUE str, VALUE sub, long offset) s = RSTRING_PTR(str); if (offset) { offset = str_offset(s, RSTRING_END(str), offset, enc, IS_7BIT(str)); + s += offset; } if (slen == 0) return offset; /* need proceed one character at a time */