summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-09 09:30:25 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-09 09:30:25 +0000
commite32da15f48189cfba02a9be2e6572161d91b3122 (patch)
tree47c660015f96f23220975c71fd69e71f8a69b6ef /bignum.c
parent8673eacafa039f056927e0f91ce195afae9b9019 (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.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bignum.c b/bignum.c
index 5e9b28c4ec..ac84ae410c 100644
--- a/bignum.c
+++ b/bignum.c
@@ -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;
}