summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-21 14:09:53 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-21 14:09:53 +0000
commit2f4529e7a686c6dc02da3b86ab0b48a81a258a7d (patch)
tree95c13b185c8b3a7369bf868c00e278808df48394 /test
parent8058fde22fd6849976c2c6f3a76a2b684a837e74 (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_2_0_0@44324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/resolv/test_addr.rb13
-rw-r--r--test/resolv/test_dns.rb11
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 0d9565ef68..07396fb177 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
@@ -150,4 +151,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