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

ruby-changes:31849

From: nobu <ko1@a...>
Date: Sat, 30 Nov 2013 13:28:20 +0900 (JST)
Subject: [ruby-changes:31849] nobu:r43928 (trunk): siphash.c: fix missing condition

nobu	2013-11-30 13:28:15 +0900 (Sat, 30 Nov 2013)

  New Revision: 43928

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

  Log:
    siphash.c: fix missing condition
    
    * siphash.c (sip_hash24): fix for aligned word access little endian
      platforms.  [ruby-core:58658] [Bug #9172]

  Modified files:
    trunk/ChangeLog
    trunk/siphash.c
    trunk/test/ruby/test_string.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43927)
+++ ChangeLog	(revision 43928)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Nov 30 13:28:13 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* siphash.c (sip_hash24): fix for aligned word access little endian
+	  platforms.  [ruby-core:58658] [Bug #9172]
+
 Sat Nov 30 13:21:15 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* vm_eval.c (rb_yield_block): implement non-nil block argument.
Index: siphash.c
===================================================================
--- siphash.c	(revision 43927)
+++ siphash.c	(revision 43928)
@@ -417,7 +417,7 @@ sip_hash24(const uint8_t key[16], const https://github.com/ruby/ruby/blob/trunk/siphash.c#L417
 	    SIP_2_ROUND(m, v0, v1, v2, v3);
         }
     }
-#elif BYTE_ORDER == BIG_ENDIAN
+#else
     for (; data != end; data += sizeof(uint64_t)) {
 	m = U8TO64_LE(data);
 	SIP_2_ROUND(m, v0, v1, v2, v3);
@@ -453,7 +453,7 @@ sip_hash24(const uint8_t key[16], const https://github.com/ruby/ruby/blob/trunk/siphash.c#L453
 	    last.lo |= ((uint32_t *) end)[0];
   #endif
 	    break;
-#elif BYTE_ORDER == BIG_ENDIAN
+#else
 	    OR_BYTE(3);
 #endif
 	case 3:
Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb	(revision 43927)
+++ test/ruby/test_string.rb	(revision 43928)
@@ -886,6 +886,8 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L886
     assert_not_equal(S("hello").hash, S("helLO").hash)
     bug4104 = '[ruby-core:33500]'
     assert_not_equal(S("a").hash, S("a\0").hash, bug4104)
+    bug9172 = '[ruby-core:58658] [Bug #9172]'
+    assert_not_equal(S("sub-setter").hash, S("discover").hash, bug9172)
   end
 
   def test_hash_random

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

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