summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-09 17:45:53 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-09 17:45:53 +0000
commit90a88ab9a09d19165cf3668b6a8473024e064fa7 (patch)
treee11fe4e2ab597cf512b2fd680b50c91cc0293a08 /bignum.c
parent80549d5f17e09173251204f08d288a71bad39256 (diff)
* marshal.c (r_object0): remove unnecessary iv restoration for
USRMARSHAL. [ruby-dev:21582] * marshal.c (w_object): dump generic instance variables from a string from '_dump'. * variable.c (rb_generic_ivar_table): return 0 if obj's FL_EXIVAR is not set. * time.c (time_dump): copy instance variables to dumped string, to be included in the marshaled data. * bignum.c (rb_big2ulong): add range check to ensure round trip. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bignum.c b/bignum.c
index 6882580eae..7c3e029d57 100644
--- a/bignum.c
+++ b/bignum.c
@@ -729,7 +729,12 @@ rb_big2ulong(x)
{
unsigned long num = big2ulong(x, "unsigned long");
- if (!RBIGNUM(x)->sign) return -num;
+ if (!RBIGNUM(x)->sign) {
+ if ((long)num < 0) {
+ rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
+ }
+ return -num;
+ }
return num;
}