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

ruby-changes:32479

From: nobu <ko1@a...>
Date: Sat, 11 Jan 2014 12:15:06 +0900 (JST)
Subject: [ruby-changes:32479] nobu:r44558 (trunk): bigdecimal.c: expand buffer

nobu	2014-01-11 12:15:01 +0900 (Sat, 11 Jan 2014)

  New Revision: 44558

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

  Log:
    bigdecimal.c: expand buffer
    
    * ext/bigdecimal/bigdecimal.c (BigMath_s_log): expand buffer size for
      64bit platforms.

  Modified files:
    trunk/ext/bigdecimal/bigdecimal.c
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 44557)
+++ ext/bigdecimal/bigdecimal.c	(revision 44558)
@@ -2919,8 +2919,8 @@ get_vp_value: https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2919
     RB_GC_GUARD(vn) = SSIZET2NUM(n);
     expo = VpExponent10(vx);
     if (expo < 0 || expo >= 3) {
-	char buf[16];
-	snprintf(buf, 16, "1E%"PRIdVALUE, -expo);
+	char buf[SIZEOF_VALUE * CHAR_BIT / 3 + 4];
+	snprintf(buf, sizeof(buf), "1E%"PRIdVALUE, -expo);
 	x = BigDecimal_mult2(x, ToValue(VpCreateRbObject(1, buf)), vn);
     }
     else {

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

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