diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/resolv/test_addr.rb | 12 | ||||
-rw-r--r-- | test/resolv/test_dns.rb | 13 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/resolv/test_addr.rb b/test/resolv/test_addr.rb index 84bc8c2d3b..d4728e1b71 100644 --- a/test/resolv/test_addr.rb +++ b/test/resolv/test_addr.rb @@ -13,4 +13,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..e3e38ef555 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,16 @@ 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 + Resolv::DNS.open(tmpfile.path) do |dns| + assert_nothing_raised(ArgumentError, bug9273) do + dns.getresources("foo.example.org", Resolv::DNS::Resource::IN::A) + end + end + end + end end |