summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bignum.c b/bignum.c
index 773cba30ba..649b258c53 100644
--- a/bignum.c
+++ b/bignum.c
@@ -829,6 +829,9 @@ big2str_find_n1(VALUE x, int base)
else if (BIGZEROP(x)) {
return 0;
}
+ else if (RBIGNUM_LEN(x) >= LONG_MAX/BITSPERDIG) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
+ }
else {
bits = BITSPERDIG*RBIGNUM_LEN(x);
}