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

ruby-changes:29789

From: akr <ko1@a...>
Date: Tue, 9 Jul 2013 01:19:29 +0900 (JST)
Subject: [ruby-changes:29789] akr:r41841 (trunk): * bignum.c (bigrsh_bang): Fix bignum digits overrun.

akr	2013-07-09 01:19:18 +0900 (Tue, 09 Jul 2013)

  New Revision: 41841

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

  Log:
    * bignum.c (bigrsh_bang): Fix bignum digits overrun.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41840)
+++ ChangeLog	(revision 41841)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul  9 01:17:57 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (bigrsh_bang): Fix bignum digits overrun.
+
 Tue Jul  9 00:46:22 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (biglsh_bang): Fix bignum digits under-run.
Index: bignum.c
===================================================================
--- bignum.c	(revision 41840)
+++ bignum.c	(revision 41841)
@@ -4452,11 +4452,11 @@ bigrsh_bang(BDIGIT* xds, long xn, unsign https://github.com/ruby/ruby/blob/trunk/bignum.c#L4452
     i = 0;
     zds = xds + s1;
     num = *zds++>>s2;
-    do {
+    while (i < xn - s1 - 1) {
 	xds[i++] = BIGLO(*zds<<s3) | num;
 	num = *zds++>>s2;
     }
-    while (i < xn - s1 - 1);
+    assert(i < xn);
     xds[i] = num;
     MEMZERO(xds + xn - s1, BDIGIT, s1);
 }

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

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