summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-26 07:43:16 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-26 07:43:16 +0000
commit63b2b93950f9b0038927537578aff87aff4a1ece (patch)
treec930ba9b062b93dcff599da724d47fddab6198d6 /string.c
parente772234fb95ee806426fffb9e219d77d74950049 (diff)
* string.c (rb_str_scan): add string modification check.
[ruby-core:7216] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 62c494a..fb8be9d 100644
--- a/string.c
+++ b/string.c
@@ -4255,6 +4255,7 @@ rb_str_scan(str, 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()) {
@@ -4272,6 +4273,7 @@ rb_str_scan(str, 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);