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

ruby-changes:26452

From: usa <ko1@a...>
Date: Thu, 20 Dec 2012 18:38:21 +0900 (JST)
Subject: [ruby-changes:26452] usa:r38503 (ruby_1_9_3): merge revision(s) 37572,37622,37766,37773: [Backport #7527]

usa	2012-12-20 18:38:11 +0900 (Thu, 20 Dec 2012)

  New Revision: 38503

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

  Log:
    merge revision(s) 37572,37622,37766,37773: [Backport #7527]
    
    * string.c (rb_str_crypt): crypt(3) may return NULL.
      Latest glibc (2.16?) crypt(3) actually returns NULL. [Bug #7312]
    
    * test/ruby/test_m17n_comb.rb (test_str_crypt): Use RbConfig to get
      libc's directory. Patched by Vit Ondruch [ruby-core:49763] [Bug #7312]

  Modified directories:
    branches/ruby_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/string.c
    branches/ruby_1_9_3/test/ruby/test_m17n_comb.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 38502)
+++ ruby_1_9_3/ChangeLog	(revision 38503)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Thu Dec 20 18:37:45 2012  NARUSE, Yui  <naruse@r...>
+
+	* test/ruby/test_m17n_comb.rb (test_str_crypt): Use RbConfig to get
+	  libc's directory. Patched by Vit Ondruch [ruby-core:49763] [Bug #7312]
+
+Thu Dec 20 18:37:45 2012  NARUSE, Yui  <naruse@r...>
+
+	* string.c (rb_str_crypt): crypt(3) may return NULL.
+	  Latest glibc (2.16?) crypt(3) actually returns NULL. [Bug #7312]
+
 Thu Dec 20 18:36:19 2012  Naohisa Goto  <ngotogenome@g...>
 
 	* ext/dl/lib/dl/func.rb (DL::Function#bind): When Fiddle is used,
Index: ruby_1_9_3/string.c
===================================================================
--- ruby_1_9_3/string.c	(revision 38502)
+++ ruby_1_9_3/string.c	(revision 38503)
@@ -6775,6 +6775,7 @@ rb_str_crypt(VALUE str, VALUE salt) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/string.c#L6775
     extern char *crypt(const char *, const char *);
     VALUE result;
     const char *s, *saltp;
+    char *res;
 #ifdef BROKEN_CRYPT
     char salt_8bit_clean[3];
 #endif
@@ -6794,7 +6795,11 @@ rb_str_crypt(VALUE str, VALUE salt) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/string.c#L6795
 	saltp = salt_8bit_clean;
     }
 #endif
-    result = rb_str_new2(crypt(s, saltp));
+    res = crypt(s, saltp);
+    if (!res) {
+	rb_sys_fail("crypt");
+    }
+    result = rb_str_new2(res);
     OBJ_INFECT(result, str);
     OBJ_INFECT(result, salt);
     return result;
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 38502)
+++ ruby_1_9_3/version.h	(revision 38503)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 349
+#define RUBY_PATCHLEVEL 350
 
 #define RUBY_RELEASE_DATE "2012-12-20"
 #define RUBY_RELEASE_YEAR 2012
Index: ruby_1_9_3/test/ruby/test_m17n_comb.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_m17n_comb.rb	(revision 38502)
+++ ruby_1_9_3/test/ruby/test_m17n_comb.rb	(revision 38503)
@@ -777,7 +777,17 @@ class TestM17NComb < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_m17n_comb.rb#L777
   end
 
   def test_str_crypt
+    begin
+      # glibc 2.16 or later denies salt contained other than [0-9A-Za-z./] #7312
+      glibcver = `#{RbConfig::CONFIG["libdir"]}/libc.so.6`[/\AGNU C Library.*version ([0-9.]+)/, 1].split('.').map(&:to_i)
+      strict_crypt = (glibcver <=> [2, 16]) > -1
+    rescue
+    end
+
     combination(STRINGS, STRINGS) {|str, salt|
+      if strict_crypt
+        next unless salt.ascii_only? && /\A[0-9a-zA-Z.\/]+\z/ =~ salt
+      end
       if a(salt).length < 2
         assert_raise(ArgumentError) { str.crypt(salt) }
         next

Property changes on: ruby_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r37572,37622,37766,37773


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

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