[前][次][番号順一覧][スレッド一覧]

ruby-changes:32245

From: nagachika <ko1@a...>
Date: Sat, 21 Dec 2013 23:10:01 +0900 (JST)
Subject: [ruby-changes:32245] nagachika:r44324 (ruby_2_0_0): merge revision(s) 44312, 44318, 44321: [Backport #9273]

nagachika	2013-12-21 23:09:53 +0900 (Sat, 21 Dec 2013)

  New Revision: 44324

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44324

  Log:
    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.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/resolv.rb
    branches/ruby_2_0_0/test/resolv/test_addr.rb
    branches/ruby_2_0_0/test/resolv/test_dns.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 44323)
+++ ruby_2_0_0/ChangeLog	(revision 44324)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sat Dec 21 22:55:03 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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.
+
 Sat Dec 21 22:51:51 2013  NAKAMURA Usaku  <usa@r...>
 
 	* win32/Makefile.sub (fake.rb): fixed wrong RUBY_PLATFORM, to correctly
Index: ruby_2_0_0/lib/resolv.rb
===================================================================
--- ruby_2_0_0/lib/resolv.rb	(revision 44323)
+++ ruby_2_0_0/lib/resolv.rb	(revision 44324)
@@ -186,7 +186,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/resolv.rb#L186
         unless @initialized
           @name2addr = {}
           @addr2name = {}
-          open(@filename) {|f|
+          open(@filename, 'rb') {|f|
             f.each {|line|
               line.sub!(/#.*/, '')
               addr, hostname, *aliases = line.split(/\s+/)
@@ -889,7 +889,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/resolv.rb#L889
         nameserver = []
         search = nil
         ndots = 1
-        open(filename) {|f|
+        open(filename, 'rb') {|f|
           f.each {|line|
             line.sub!(/[#;].*/, '')
             keyword, *args = line.split(/\s+/)
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 44323)
+++ ruby_2_0_0/version.h	(revision 44324)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-12-21"
-#define RUBY_PATCHLEVEL 367
+#define RUBY_PATCHLEVEL 368
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 12
Index: ruby_2_0_0/test/resolv/test_dns.rb
===================================================================
--- ruby_2_0_0/test/resolv/test_dns.rb	(revision 44323)
+++ ruby_2_0_0/test/resolv/test_dns.rb	(revision 44324)
@@ -1,6 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/resolv/test_dns.rb#L1
 require 'test/unit'
 require 'resolv'
 require 'socket'
+require 'tempfile'
 
 class TestResolvDNS < Test::Unit::TestCase
   def setup
@@ -150,4 +151,14 @@ class TestResolvDNS < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/resolv/test_dns.rb#L151
     }
   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
Index: ruby_2_0_0/test/resolv/test_addr.rb
===================================================================
--- ruby_2_0_0/test/resolv/test_addr.rb	(revision 44323)
+++ ruby_2_0_0/test/resolv/test_addr.rb	(revision 44324)
@@ -1,6 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/resolv/test_addr.rb#L1
 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::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/resolv/test_addr.rb#L14
       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

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r44312,44318,44321


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]