summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-24 05:53:43 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-24 05:53:43 +0000
commitc0a998d027eac8e9dc6d85b4b56c5e5bc87024a0 (patch)
tree49adb0e44abfd9d14f9c47517039e333bb98c50a /string.c
parent0c9d76889af8e00a946dbe8de33568fc87bdd983 (diff)
* parse.y (rb_parser_append_print): should handle prelude.
[llama@u01.gate0] * parse.y (rb_parser_while_loop): ditto. * array.c (rb_ary_subseq): original object might be modified after sharing data creation. [ruby-dev:24327] * array.c (rb_ary_replace): ditto. * array.c (ary_make_shared): freeze shared array. [ruby-dev:24325] * struct.c (struct_members): always check struct size and size of members list in the class. [ruby-dev:24320] * string.c (rb_str_sub_bang): check if string is not modified during iteration. [ruby-dev:24315] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/string.c b/string.c
index 5814836a7a..933c233a53 100644
--- a/string.c
+++ b/string.c
@@ -1927,8 +1927,13 @@ rb_str_sub_bang(argc, argv, str)
regs = RMATCH(match)->regs;
if (iter) {
+ char *p = RSTRING(str)->ptr; long len = RSTRING(str)->len;
+
rb_match_busy(match);
repl = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
+ if (RSTRING(str)->ptr != p || RSTRING(str)->len != len) {
+ rb_raise(rb_eRuntimeError, "string modified");
+ }
rb_backref_set(match);
}
else {