integer overflow in mpz/clear.c of GMP 5.1.3

Vincent Lefevre vincent at
Fri Jan 17 15:55:33 UTC 2014

On 2014-01-17 16:49:29 +0100, Torbjorn Granlund wrote:
> GMP only supports 2^32-eps *bits* for 32bit machines and 2^37-eps bits
> for 64bit machines.  An allocation counted in bytes will therefore not
> exceed 2^31-1.  The way the bits limits are enforced is via the bytes
> allocation, in most places!

I think that GMP should have assertions in case the user provides
values that are larger than supported.

Vincent Lefèvre <vincent at> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

More information about the gmp-bugs mailing list