integer overflow yields incorrect results and buffer overflow on 64-bit machines
tg at swox.com
Mon Mar 3 23:24:34 CET 2008
Vincent Lefevre <vincent at vinc17.org> writes:
On 2008-02-27 18:19:39 +0100, Torbjorn Granlund wrote:
> What do you think of this change?
On second thought, something trickier will be needed for 32-bit
machines (or actually any machine where sizeof(int) = sizeof(long))
since we don't support operands greater than whose bit count can be
stored in an unsigned long int.
However there's a possible overflow in n_pow_ui.c.
And it's not easy to handle that without a umul_ppmm in the general
case. Using umul_ppmm is no disaster, but I prefer to stay away from
it when possible, since it is expensive on certain machines.
More information about the gmp-bugs