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

ruby-changes:29585

From: akr <ko1@a...>
Date: Wed, 26 Jun 2013 07:28:54 +0900 (JST)
Subject: [ruby-changes:29585] akr:r41637 (trunk): * bignum.c (bigand_int): Fix a buffer over read.

akr	2013-06-26 07:28:43 +0900 (Wed, 26 Jun 2013)

  New Revision: 41637

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

  Log:
    * bignum.c (bigand_int): Fix a buffer over read.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41636)
+++ ChangeLog	(revision 41637)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jun 26 07:27:17 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (bigand_int): Fix a buffer over read.
+
 Wed Jun 26 06:48:07 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (bigadd_int): Fix a buffer over read.
Index: bignum.c
===================================================================
--- bignum.c	(revision 41636)
+++ bignum.c	(revision 41637)
@@ -4651,13 +4651,10 @@ bigand_int(VALUE x, long y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4651
     i = 1;
     zds[0] = xds[0] & y;
 #else
-    {
-	long num = y;
-
-	for (i=0; i<bdigit_roomof(SIZEOF_LONG); i++) {
-	    zds[i] = xds[i] & BIGLO(num);
-	    num = BIGDN(num);
-	}
+    for (i=0; i < xn; i++) {
+        if (y == 0 || y == -1) break;
+        zds[i] = xds[i] & BIGLO(y);
+        y = BIGDN(y);
     }
 #endif
     while (i < xn) {

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

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