From 415a9700fe809af22cd5c5334a7b69c6ce667f3b Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 16 Aug 2007 13:45:37 +0000 Subject: * 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@13069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bignum.c | 1 + 1 file changed, 1 insertion(+) (limited to 'bignum.c') diff --git a/bignum.c b/bignum.c index e49a18b118..e6ecb3933b 100644 --- a/bignum.c +++ b/bignum.c @@ -104,6 +104,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; -- cgit v1.2.3