ruby-changes:18542
From: yugui <ko1@a...>
Date: Sun, 16 Jan 2011 21:40:28 +0900 (JST)
Subject: [ruby-changes:18542] Ruby:r30565 (ruby_1_9_2): merges r30467 from trunk into ruby_1_9_2.
yugui 2011-01-16 21:34:45 +0900 (Sun, 16 Jan 2011) New Revision: 30565 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30565 Log: merges r30467 from trunk into ruby_1_9_2. -- * ext/stringio/stringio.c (get_strio, strio_set_string) (strio_reopen): check if frozen. [ruby-core:33648] Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/ext/stringio/stringio.c branches/ruby_1_9_2/test/stringio/test_stringio.rb branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 30564) +++ ruby_1_9_2/ChangeLog (revision 30565) @@ -1,3 +1,8 @@ +Thu Jan 6 05:14:41 2011 Nobuyoshi Nakada <nobu@r...> + + * ext/stringio/stringio.c (get_strio, strio_set_string) + (strio_reopen): check if frozen. [ruby-core:33648] + Wed Jan 5 13:56:54 2011 Akinori MUSHA <knu@i...> * lib/net/http.rb (Net::HTTP#get): A header hash given should not Index: ruby_1_9_2/ext/stringio/stringio.c =================================================================== --- ruby_1_9_2/ext/stringio/stringio.c (revision 30564) +++ ruby_1_9_2/ext/stringio/stringio.c (revision 30565) @@ -83,7 +83,7 @@ static struct StringIO* get_strio(VALUE self) { - struct StringIO *ptr = check_strio(self); + struct StringIO *ptr = check_strio(rb_io_taint_check(self)); if (!ptr) { rb_raise(rb_eIOError, "uninitialized stream"); @@ -310,7 +310,7 @@ { struct StringIO *ptr = StringIO(self); - if (!OBJ_TAINTED(self)) rb_secure(4); + rb_io_taint_check(self); ptr->flags &= ~FMODE_READWRITE; StringValue(string); ptr->flags = OBJ_FROZEN(string) ? FMODE_READABLE : FMODE_READWRITE; @@ -502,7 +502,7 @@ static VALUE strio_reopen(int argc, VALUE *argv, VALUE self) { - if (!OBJ_TAINTED(self)) rb_secure(4); + rb_io_taint_check(self); if (argc == 1 && TYPE(*argv) != T_STRING) { return strio_copy(self, *argv); } Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 30564) +++ ruby_1_9_2/version.h (revision 30565) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 145 +#define RUBY_PATCHLEVEL 146 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_2/test/stringio/test_stringio.rb =================================================================== --- ruby_1_9_2/test/stringio/test_stringio.rb (revision 30564) +++ ruby_1_9_2/test/stringio/test_stringio.rb (revision 30565) @@ -471,4 +471,13 @@ expected_pos += 1 end end + + def test_frozen + s = StringIO.new + s.freeze + bug = '[ruby-core:33648]' + assert_raise(RuntimeError, bug) {s.puts("foo")} + assert_raise(RuntimeError, bug) {s.string = "foo"} + assert_raise(RuntimeError, bug) {s.reopen("")} + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/