1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

bigdecimal.c: expand buffer

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-01-11 03:15:01 +00:00
parent b89a88f043
commit 2b1c47dadc

View file

@ -2919,8 +2919,8 @@ get_vp_value:
RB_GC_GUARD(vn) = SSIZET2NUM(n); RB_GC_GUARD(vn) = SSIZET2NUM(n);
expo = VpExponent10(vx); expo = VpExponent10(vx);
if (expo < 0 || expo >= 3) { if (expo < 0 || expo >= 3) {
char buf[16]; char buf[SIZEOF_VALUE * CHAR_BIT / 3 + 4];
snprintf(buf, 16, "1E%"PRIdVALUE, -expo); snprintf(buf, sizeof(buf), "1E%"PRIdVALUE, -expo);
x = BigDecimal_mult2(x, ToValue(VpCreateRbObject(1, buf)), vn); x = BigDecimal_mult2(x, ToValue(VpCreateRbObject(1, buf)), vn);
} }
else { else {