diff --git a/ChangeLog b/ChangeLog index 64071007c5..c649166b95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 15 17:41:31 2012 NARUSE, Yui + + * io.c (io_strsetbuf): call rb_str_modify to make str independent + before calling rb_str_set_len for r34580. + Wed Feb 15 12:30:10 2012 Eric Hodel * ext/zlib/zlib.c (Init_zlib): Added Zlib::TEXT and note that diff --git a/io.c b/io.c index 074d2c50f7..f404b539a4 100644 --- a/io.c +++ b/io.c @@ -2084,7 +2084,10 @@ io_setstrbuf(VALUE *str, long len) VALUE s = StringValue(*str); long clen = RSTRING_LEN(s); if (clen >= len) { - if (clen != len) rb_str_set_len(s, len); + if (clen != len) { + rb_str_modify(s); + rb_str_set_len(s, len); + } return; } len -= clen;