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

ruby-changes:29787

From: akr <ko1@a...>
Date: Tue, 9 Jul 2013 00:48:21 +0900 (JST)
Subject: [ruby-changes:29787] akr:r41839 (trunk): * bignum.c (biglsh_bang): Fix bignum digits under-run.

akr	2013-07-09 00:48:09 +0900 (Tue, 09 Jul 2013)

  New Revision: 41839

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

  Log:
    * bignum.c (biglsh_bang): Fix bignum digits under-run.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41838)
+++ ChangeLog	(revision 41839)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul  9 00:46:22 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (biglsh_bang): Fix bignum digits under-run.
+
 Mon Jul  8 23:36:45 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/dl/win32/lib/win32/registry.rb (Error, API): use WCHAR
Index: bignum.c
===================================================================
--- bignum.c	(revision 41838)
+++ bignum.c	(revision 41839)
@@ -4425,11 +4425,11 @@ biglsh_bang(BDIGIT *xds, long xn, unsign https://github.com/ruby/ruby/blob/trunk/bignum.c#L4425
     zds = xds + xn - 1;
     xn -= s1 + 1;
     num = BIGLO(xds[xn]<<s2);
-    do {
+    while (0 < xn) {
 	*zds-- = num | xds[--xn]>>s3;
 	num = BIGLO(xds[xn]<<s2);
     }
-    while (xn > 0);
+    assert(xds <= zds);
     *zds = num;
     for (i = s1; i > 0; --i)
 	*zds-- = 0;

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

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