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

ruby-changes:13601

From: mame <ko1@a...>
Date: Sat, 17 Oct 2009 17:31:23 +0900 (JST)
Subject: [ruby-changes:13601] Ruby:r25383 (trunk): * bignum.c (big_split): fix off-by-one error.

mame	2009-10-17 17:31:07 +0900 (Sat, 17 Oct 2009)

  New Revision: 25383

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

  Log:
    * bignum.c (big_split): fix off-by-one error.  [ruby-dev:39501]

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25382)
+++ ChangeLog	(revision 25383)
@@ -1,3 +1,7 @@
+Sat Oct 17 17:30:06 2009  Yusuke Endoh  <mame@t...>
+
+	* bignum.c (big_split): fix off-by-one error.  [ruby-dev:39501]
+
 Sat Oct 17 16:34:27 2009  Tanaka Akira  <akr@f...>
 
 	* parse.y (parser_yylex): fix token even after trailing under score.
Index: bignum.c
===================================================================
--- bignum.c	(revision 25382)
+++ bignum.c	(revision 25383)
@@ -1848,13 +1848,13 @@
 
     while (--hn && !vds[hn + ln]);
     h = bignew(hn += 2, 1);
-    MEMCPY(BDIGITS(h), vds + ln, BDIGIT, hn);
-    BDIGITS(h)[hn - 1] = 0;
+    MEMCPY(BDIGITS(h), vds + ln, BDIGIT, hn - 1);
+    BDIGITS(h)[hn - 1] = 0; /* margin for carry */
 
     while (--ln && !vds[ln]);
     l = bignew(ln += 2, 1);
-    MEMCPY(BDIGITS(l), vds, BDIGIT, ln);
-    BDIGITS(l)[ln - 1] = 0;
+    MEMCPY(BDIGITS(l), vds, BDIGIT, ln - 1);
+    BDIGITS(l)[ln - 1] = 0; /* margin for carry */
 
     *pl = l;
     *ph = h;

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

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