summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--string.c1
2 files changed, 4 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index de247ca11..961076209 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@ Wed Dec 19 22:59:52 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_chomp_bang): wrong adjust condition.
+ * string.c (rb_str_rindex): comparison length should be based on
+ bytes, not characters.
+
Wed Dec 19 21:42:18 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* re.c (rb_reg_regsub): should set checked encoding.
diff --git a/string.c b/string.c
index 9a9de2e64..3f348f266 100644
--- a/string.c
+++ b/string.c
@@ -1569,6 +1569,7 @@ rb_str_rindex(VALUE str, VALUE sub, long pos)
sbeg = RSTRING_PTR(str);
e = RSTRING_END(str);
t = RSTRING_PTR(sub);
+ slen = RSTRING_LEN(sub);
for (;;) {
s = str_nth(sbeg, e, pos, enc, asc);
if (!s) return -1;