ruby-changes:15081
From: mame <ko1@a...>
Date: Wed, 17 Mar 2010 01:26:22 +0900 (JST)
Subject: [ruby-changes:15081] Ruby:r26957 (trunk): * parse.y (rb_intern3): prohibit Symbol with an invalid encoding.
mame 2010-03-17 01:26:04 +0900 (Wed, 17 Mar 2010) New Revision: 26957 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26957 Log: * parse.y (rb_intern3): prohibit Symbol with an invalid encoding. [ruby-core:24621] * test/ruby/test_m17n_comb.rb: modify a test for above. Modified files: trunk/ChangeLog trunk/NEWS trunk/parse.y trunk/test/ruby/test_m17n_comb.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 26956) +++ ChangeLog (revision 26957) @@ -1,3 +1,10 @@ +Wed Mar 17 01:24:01 2010 Yusuke Endoh <mame@t...> + + * parse.y (rb_intern3): prohibit Symbol with an invalid encoding. + [ruby-core:24621] + + * test/ruby/test_m17n_comb.rb: modify a test for above. + Tue Mar 16 22:51:11 2010 Tanaka Akira <akr@f...> * tool/transcode-tblgen.rb: specialize for singletom mappings. Index: parse.y =================================================================== --- parse.y (revision 26956) +++ parse.y (revision 26957) @@ -9505,6 +9505,10 @@ str = (VALUE)&fake_str; rb_enc_associate(str, enc); + if (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) { + rb_raise(rb_eEncodingError, "invalid encoding symbol"); + } + if (st_lookup(global_symbols.sym_id, str, (st_data_t *)&id)) return id; Index: NEWS =================================================================== --- NEWS (revision 26956) +++ NEWS (revision 26957) @@ -313,6 +313,7 @@ * \d, \s, and \w are now ASCII only; use POSIX bracket classes and \p{} for Unicode semantics * $: no longer includes the current directory, use require_relative +* Symbol with an invalid encoding is forbidden to exist. === Compilation options Index: test/ruby/test_m17n_comb.rb =================================================================== --- test/ruby/test_m17n_comb.rb (revision 26956) +++ test/ruby/test_m17n_comb.rb (revision 26957) @@ -1040,10 +1040,12 @@ STRINGS.each {|s| if /\0/ =~ a(s) assert_raise(ArgumentError) { s.intern } - else + elsif s.valid_encoding? sym = s.intern assert_equal(s, sym.to_s, "#{encdump s}.intern.to_s") assert_equal(sym, s.to_sym) + else + assert_raise(EncodingError) { s.intern } end } end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/