mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (rb_intern3): prohibit Symbol with an invalid encoding.
[ruby-core:24621] * test/ruby/test_m17n_comb.rb: modify a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0b6a0045aa
commit
4f78e7fff4
4 changed files with 15 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Mar 17 01:24:01 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* 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@fsij.org>
|
||||
|
||||
* tool/transcode-tblgen.rb: specialize for singletom mappings.
|
||||
|
|
1
NEWS
1
NEWS
|
@ -313,6 +313,7 @@ with all sufficient information, see the ChangeLog file.
|
|||
* \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
|
||||
|
||||
|
|
4
parse.y
4
parse.y
|
@ -9505,6 +9505,10 @@ rb_intern3(const char *name, long len, rb_encoding *enc)
|
|||
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;
|
||||
|
||||
|
|
|
@ -1040,10 +1040,12 @@ class TestM17NComb < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue