From c0a998d027eac8e9dc6d85b4b56c5e5bc87024a0 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 24 Sep 2004 05:53:43 +0000 Subject: * 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 --- string.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'string.c') 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 { -- cgit v1.2.3