integer overflow in mpn/get_d.c from GMP 5.1.2

Marc Glisse marc.glisse at inria.fr
Fri Sep 20 16:38:14 CEST 2013


On Fri, 20 Sep 2013, Vincent Lefevre wrote:

> In GMP 5.1.2, there's an integer overflow in mpn/get_d.c:
>
>  if (UNLIKELY ((unsigned long) (GMP_NUMB_BITS * size)
>                > (unsigned long) (LONG_MAX - exp)))
>
> It should be replaced by:
>
>  if (UNLIKELY ((unsigned long) (GMP_NUMB_BITS * size)
>                > (unsigned long) LONG_MAX - exp))

Looks like I fixed it last June (I don't remember if I backported it).

-- 
Marc Glisse


More information about the gmp-bugs mailing list