summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
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 16939e15f6..816dde4b0b 100644
--- a/string.c
+++ b/string.c
@@ -3919,6 +3919,7 @@ rb_str_scan(VALUE str, VALUE pat)
VALUE result;
long start = 0;
VALUE match = Qnil;
+ char *p = RSTRING(str)->ptr; long len = RSTRING(str)->len;
pat = get_pat(pat, 1);
if (!rb_block_given_p()) {
@@ -3936,6 +3937,7 @@ rb_str_scan(VALUE str, VALUE pat)
match = rb_backref_get();
rb_match_busy(match);
rb_yield(result);
+ str_mod_check(str, p, len);
rb_backref_set(match); /* restore $~ value */
}
rb_backref_set(match);