summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/string.c b/string.c
index 26b57b5e3..180d869ac 100644
--- a/string.c
+++ b/string.c
@@ -2167,6 +2167,9 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str)
}
}
+ pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
+ rb_enc_check(str, sub), single_byte_optimizable(str));
+
switch (TYPE(sub)) {
case T_REGEXP:
pos = rb_reg_adjust_startpos(sub, str, pos, 0);
@@ -2277,6 +2280,9 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
pos = len;
}
+ pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
+ rb_enc_check(str, sub), single_byte_optimizable(str));
+
switch (TYPE(sub)) {
case T_REGEXP:
/* enc = rb_get_check(str, sub); */