diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-04 10:15:34 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-04 10:15:34 +0000 |
commit | 45c37073038bde691ef12350277cd5a0b7796ec3 (patch) | |
tree | a0008d75fa81363442708cdaa98272e426bb8415 /test/ruby/test_io_m17n.rb | |
parent | 1633eb7238776b94a5f162b85f225423174e4c26 (diff) |
* include/ruby/encoding.h (ECONV_INVALID_IGNORE): removed because
it tend to cause security problem. If the behaviour is really
required, ECONV_INVALID_REPLACE with empty string can be used.
For example, CVE-2006-2313, CVE-2008-1036, [ruby-core:15645]
(ECONV_UNDEF_IGNORE): ditto.
* transcode.c (rb_econv_convert): follow the above change.
(econv_opts): ditto.
(Init_transcode): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r-- | test/ruby/test_io_m17n.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 67f48527b5..550d163bc2 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -1312,14 +1312,14 @@ EOT open("t.txt", "r:utf-8:euc-jp", :invalid => :replace) {|f| assert_equal("a?b", f.read) } - open("t.txt", "r:utf-8:euc-jp", :invalid => :ignore) {|f| + open("t.txt", "r:utf-8:euc-jp", :invalid => :replace, :replace => "") {|f| assert_equal("ab", f.read) } open("t.txt", "r:utf-8:euc-jp", :undef => :replace) {|f| assert_raise(Encoding::InvalidByteSequence) { f.read } assert_equal("b", f.read) } - open("t.txt", "r:utf-8:euc-jp", :undef => :ignore) {|f| + open("t.txt", "r:utf-8:euc-jp", :undef => :replace, :replace => "") {|f| assert_raise(Encoding::InvalidByteSequence) { f.read } assert_equal("b", f.read) } @@ -1332,14 +1332,14 @@ EOT open("t.txt", "r:utf-8:euc-jp", :undef => :replace) {|f| assert_equal("a?b", f.read) } - open("t.txt", "r:utf-8:euc-jp", :undef => :ignore) {|f| + open("t.txt", "r:utf-8:euc-jp", :undef => :replace, :replace => "") {|f| assert_equal("ab", f.read) } open("t.txt", "r:utf-8:euc-jp", :invalid => :replace) {|f| assert_raise(Encoding::ConversionUndefined) { f.read } assert_equal("b", f.read) } - open("t.txt", "r:utf-8:euc-jp", :invalid => :ignore) {|f| + open("t.txt", "r:utf-8:euc-jp", :invalid => :replace, :replace => "") {|f| assert_raise(Encoding::ConversionUndefined) { f.read } assert_equal("b", f.read) } @@ -1354,7 +1354,7 @@ EOT } assert_equal("a?b", File.read("t.txt")) - open("t.txt", "w:euc-jp", :invalid => :ignore) {|f| + open("t.txt", "w:euc-jp", :invalid => :replace, :replace => "") {|f| assert_nothing_raised { f.write invalid_utf8 } } assert_equal("ab", File.read("t.txt")) @@ -1362,7 +1362,7 @@ EOT open("t.txt", "w:euc-jp", :undef => :replace) {|f| assert_raise(Encoding::InvalidByteSequence) { f.write invalid_utf8 } } - open("t.txt", "w:euc-jp", :undef => :ignore) {|f| + open("t.txt", "w:euc-jp", :undef => :replace, :replace => "") {|f| assert_raise(Encoding::InvalidByteSequence) { f.write invalid_utf8 } } } @@ -1375,14 +1375,14 @@ EOT assert_nothing_raised { f.write "a\uFFFDb" } } assert_equal("a?b", File.read("t.txt")) - open("t.txt", "w:euc-jp:utf-8", :undef => :ignore) {|f| + open("t.txt", "w:euc-jp:utf-8", :undef => :replace, :replace => "") {|f| assert_nothing_raised { f.write "a\uFFFDb" } } assert_equal("ab", File.read("t.txt")) open("t.txt", "w:euc-jp:utf-8", :invalid => :replace) {|f| assert_raise(Encoding::ConversionUndefined) { f.write "a\uFFFDb" } } - open("t.txt", "w:euc-jp:utf-8", :invalid => :ignore) {|f| + open("t.txt", "w:euc-jp:utf-8", :invalid => :replace, :replace => "") {|f| assert_raise(Encoding::ConversionUndefined) { f.write "a\uFFFDb" } } } @@ -1395,14 +1395,14 @@ EOT assert_nothing_raised { f.write "a\uFFFDb" } } assert_equal("a?b", File.read("t.txt")) - open("t.txt", "w:iso-2022-jp:utf-8", :undef => :ignore) {|f| + open("t.txt", "w:iso-2022-jp:utf-8", :undef => :replace, :replace => "") {|f| assert_nothing_raised { f.write "a\uFFFDb" } } assert_equal("ab", File.read("t.txt")) open("t.txt", "w:iso-2022-jp:utf-8", :invalid => :replace) {|f| assert_raise(Encoding::ConversionUndefined) { f.write "a\uFFFDb" } } - open("t.txt", "w:iso-2022-jp:utf-8", :invalid => :ignore) {|f| + open("t.txt", "w:iso-2022-jp:utf-8", :invalid => :replace, :replace => "") {|f| assert_raise(Encoding::ConversionUndefined) { f.write "a\uFFFDb" } } } |