overflow in mpz_sizeinbase

Linus Nordberg linus at nordberg.se
Fri Apr 22 20:29:36 CEST 2005

jweening at ccrwest.org (Joe Weening) wrote
Wed, 20 Apr 2005 17:25:22 -0700 (PDT):

|  This causes the "size" argument of MPN_SIZEINBASE to be of type "int",
|  and the computation
|          __totbits = (size) * GMP_NUMB_BITS - (__cnt - GMP_NAIL_BITS);   \
|  in gmp-impl.h overflows when (size) * GMP_NUMB_BITS is 2^31 or more,

This problem is addressed in the gmp-impl.h.MPN_SIZEINBASE.diff [1]
patch, announced on the GMP pages under "Status of the current
release" [2].

Please keep bug reports on the gmp-bugs at swox.com.  (My fault approving
this to the developers list.  Sorry for that.)

[1] http://swox.com/gmp/patches/gmp-impl.h.MPN_SIZEINBASE.diff
[2] http://swox.com/gmp/#STATUS

More information about the gmp-devel mailing list