summaryrefslogtreecommitdiffstats
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-16 22:22:24 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-16 22:22:24 +0000
commit49a990604744d073ce9cafe10f1c1587b6d771c5 (patch)
tree266edb86fc4affd07f7b3b5d973eaad5ab52d657 /bignum.c
parentc7441fc1de3cc8590311601e78a78cbe117b6491 (diff)
downloadruby-49a990604744d073ce9cafe10f1c1587b6d771c5.tar.gz
ruby-49a990604744d073ce9cafe10f1c1587b6d771c5.tar.xz
ruby-49a990604744d073ce9cafe10f1c1587b6d771c5.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@13074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/bignum.c b/bignum.c
index fc7329b5e..fcfe64983 100644
--- a/bignum.c
+++ b/bignum.c
@@ -97,6 +97,7 @@ bigtrunc(VALUE x)
long len = RBIGNUM(x)->len;
BDIGIT *ds = BDIGITS(x);
+ if (len == 0) return x;
while (--len && !ds[len]);
RBIGNUM(x)->len = ++len;
return x;