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 | 61f8b79aee55fe6eb56cc1f68a35ee42675d0320 (patch) | |
| tree | a0008d75fa81363442708cdaa98272e426bb8415 /test/ruby/test_transcode.rb | |
| parent | 970524f9fa95fef27eeb3f218e182cef4065855c (diff) | |
| download | ruby-61f8b79aee55fe6eb56cc1f68a35ee42675d0320.tar.gz ruby-61f8b79aee55fe6eb56cc1f68a35ee42675d0320.tar.xz ruby-61f8b79aee55fe6eb56cc1f68a35ee42675d0320.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@19123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_transcode.rb')
| -rw-r--r-- | test/ruby/test_transcode.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index 2bf8f04de..614d4ceb0 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -247,23 +247,23 @@ class TestTranscode < Test::Unit::TestCase def test_invalid_ignore # arguments only - assert_nothing_raised { 'abc'.encode('utf-8', invalid: :ignore) } + assert_nothing_raised { 'abc'.encode('utf-8', invalid: :replace, replace: "") } # check handling of UTF-8 ill-formed subsequences assert_equal("\x00\x41\x00\x3E\x00\x42".force_encoding('UTF-16BE'), - "\x41\xC2\x3E\x42".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) + "\x41\xC2\x3E\x42".encode('UTF-16BE', 'UTF-8', invalid: :replace, replace: "")) assert_equal("\x00\x41\x00\xF1\x00\x42".force_encoding('UTF-16BE'), - "\x41\xC2\xC3\xB1\x42".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) + "\x41\xC2\xC3\xB1\x42".encode('UTF-16BE', 'UTF-8', invalid: :replace, replace: "")) assert_equal("\x00\x42".force_encoding('UTF-16BE'), - "\xF0\x80\x80\x42".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) + "\xF0\x80\x80\x42".encode('UTF-16BE', 'UTF-8', invalid: :replace, replace: "")) assert_equal(''.force_encoding('UTF-16BE'), - "\x82\xAB".encode('UTF-16BE', 'UTF-8', invalid: :ignore)) + "\x82\xAB".encode('UTF-16BE', 'UTF-8', invalid: :replace, replace: "")) assert_equal("\e$B!!\e(B".force_encoding("ISO-2022-JP"), - "\xA1\xA1\xFF".encode("ISO-2022-JP", "EUC-JP", invalid: :ignore)) + "\xA1\xA1\xFF".encode("ISO-2022-JP", "EUC-JP", invalid: :replace, replace: "")) assert_equal("\e$B\x24\x22\x24\x24\e(B".force_encoding("ISO-2022-JP"), - "\xA4\xA2\xFF\xA4\xA4".encode("ISO-2022-JP", "EUC-JP", invalid: :ignore)) + "\xA4\xA2\xFF\xA4\xA4".encode("ISO-2022-JP", "EUC-JP", invalid: :replace, replace: "")) assert_equal("\e$B\x24\x22\x24\x24\e(B".force_encoding("ISO-2022-JP"), - "\xA4\xA2\xFF\xFF\xA4\xA4".encode("ISO-2022-JP", "EUC-JP", invalid: :ignore)) + "\xA4\xA2\xFF\xFF\xA4\xA4".encode("ISO-2022-JP", "EUC-JP", invalid: :replace, replace: "")) end def test_invalid_replace |
