diff --git a/ChangeLog b/ChangeLog index 7748ac8f36..8a4f0162d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Mar 13 09:30:12 2009 Nobuyoshi Nakada + + * bignum.c (bigfixize): zero length Bignum is 0. + Fri Mar 13 08:06:48 2009 Nobuyoshi Nakada * util.c (rv_strdup): macro to duplicate nul-terminated string. diff --git a/bignum.c b/bignum.c index f508f71e02..3a317d0065 100644 --- a/bignum.c +++ b/bignum.c @@ -191,7 +191,8 @@ bigfixize(VALUE x) long len = RBIGNUM_LEN(x); BDIGIT *ds = BDIGITS(x); - if (len > 0 && len*SIZEOF_BDIGITS <= sizeof(long)) { + if (len == 0) return INT2FIX(0); + if (len*SIZEOF_BDIGITS <= sizeof(long)) { long num = 0; #if 2*SIZEOF_BDIGITS > SIZEOF_LONG num = (long)ds[0];