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
This commit is contained in:
nagachika 2013-12-21 14:09:53 +00:00
parent 8058fde22f
commit 2f4529e7a6
5 changed files with 34 additions and 3 deletions

View file

@ -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