diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-16 22:22:24 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-16 22:22:24 +0000 |
commit | bef0b1fa361728e144ec97a2a7ab88feb6752c69 (patch) | |
tree | 266edb86fc4affd07f7b3b5d973eaad5ab52d657 /sprintf.c | |
parent | 04176dc21fb74c26a12895319a86eb2c3b138f90 (diff) |
* bignum.c (bigtrunc): RBIGNUM(x)->len may be zero. out of bound
access. [ruby-dev:31404]
* sprintf.c (rb_str_format): small float should not call
rb_dbl2big().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r-- | sprintf.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -522,6 +522,10 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt) bin_retry: switch (TYPE(val)) { case T_FLOAT: + if (FIXABLE((long)RFLOAT(val)->value)) { + val = LONG2FIX((long)RFLOAT(val)->value); + goto bin_retry; + } val = rb_dbl2big(RFLOAT(val)->value); if (FIXNUM_P(val)) goto bin_retry; bignum = 1; |