summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-19 02:13:21 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-19 02:13:21 +0000
commitde7245982714246631617299b6501fa0a0f472d7 (patch)
tree362cc8e88367c6c99f8e1d4153e3304baa718b8e /bignum.c
parentd9a45b677e559457bdef2118cd2829cce67501fa (diff)
* bignum.c (bigtrunc): RBIGNUM(x)->len may be zero. out of bound
access. [ruby-dev:31404] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@13468 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 547759f099..788eb4bfd2 100644
--- a/bignum.c
+++ b/bignum.c
@@ -103,6 +103,7 @@ bigtrunc(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;