diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-04-09 09:30:25 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-04-09 09:30:25 +0000 |
commit | e32da15f48189cfba02a9be2e6572161d91b3122 (patch) | |
tree | 47c660015f96f23220975c71fd69e71f8a69b6ef /bignum.c | |
parent | 8673eacafa039f056927e0f91ce195afae9b9019 (diff) |
1.1b9_09 pre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -350,14 +350,17 @@ big2int(x) UINT len = RBIGNUM(x)->len; USHORT *ds; - if (len > sizeof(long)/sizeof(USHORT)) - ArgError("Bignum too big to convert into fixnum"); + if (len > sizeof(INT)/sizeof(USHORT)) + ArgError("bignum too big to convert into `int'"); ds = BDIGITS(x); num = 0; while (len--) { num = BIGUP(num); num += ds[len]; } + if ((INT)num < 0) { + ArgError("bignum too big to convert into `int'"); + } if (!RBIGNUM(x)->sign) return -num; return num; } |