diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-01-29 04:30:54 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-01-29 04:30:54 +0000 |
commit | 888372e5957f4e59b03532bc6fa9e1657b81ecad (patch) | |
tree | f0e303c2cdecb530028e9f6a4546f2bbbcad79d7 /test | |
parent | 12aec90ddfecdcc6190e7fe06d0cbc5a05ff092d (diff) |
merge revision(s) 44312,44318,44321: [Backport #9273]
* lib/resolv.rb (Resolv::Hosts#lazy_initialize): should not
consider encodings in hosts file. [ruby-core:59239] [Bug #9273]
* lib/resolv.rb (Resolv::Config.parse_resolv_conf): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@44739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/resolv/test_addr.rb | 13 | ||||
-rw-r--r-- | test/resolv/test_dns.rb | 11 |
2 files changed, 24 insertions, 0 deletions
diff --git a/test/resolv/test_addr.rb b/test/resolv/test_addr.rb index 84bc8c2d3b..b4718430cc 100644 --- a/test/resolv/test_addr.rb +++ b/test/resolv/test_addr.rb @@ -1,6 +1,7 @@ require 'test/unit' require 'resolv' require 'socket' +require 'tempfile' class TestResolvAddr < Test::Unit::TestCase def test_invalid_ipv4_address @@ -13,4 +14,16 @@ class TestResolvAddr < Test::Unit::TestCase end } end + + def test_invalid_byte_comment + bug9273 = '[ruby-core:59239] [Bug #9273]' + Tempfile.open('resolv_test_addr_') do |tmpfile| + tmpfile.print("\xff\x00\x40") + tmpfile.close + hosts = Resolv::Hosts.new(tmpfile.path) + assert_nothing_raised(ArgumentError, bug9273) do + hosts.each_address("") {break} + end + end + end end diff --git a/test/resolv/test_dns.rb b/test/resolv/test_dns.rb index 9a9c33ea84..0b2a8aacd6 100644 --- a/test/resolv/test_dns.rb +++ b/test/resolv/test_dns.rb @@ -1,6 +1,7 @@ require 'test/unit' require 'resolv' require 'socket' +require 'tempfile' class TestResolvDNS < Test::Unit::TestCase def setup @@ -118,4 +119,14 @@ class TestResolvDNS < Test::Unit::TestCase } end + def test_invalid_byte_comment + bug9273 = '[ruby-core:59239] [Bug #9273]' + Tempfile.open('resolv_test_dns_') do |tmpfile| + tmpfile.print("\xff\x00\x40") + tmpfile.close + assert_nothing_raised(ArgumentError, bug9273) do + Resolv::DNS::Config.parse_resolv_conf(tmpfile.path) + end + end + end end |