mpn_mul_fft type overflow issue

Torbjorn Granlund tg at
Wed Sep 18 12:27:00 CEST 2013

Hello Mark!

I cannot say that we were unaware of these type probems in mul_fft.c.
Since I have no machine where to test changes, I have postponed fixing
these problems.

I am glad you have had a chance to clean this up.

Some questions, though:

* How did you test the original code/modified code?  Did you test it
  systematically, say with a modified tests/mpz/t-mul, or did you just
  run into a problem frm an application?

* How much of non-multiply GMP code have you tested for these huge
  operands?  I don't expect many type problems elsewhere, but to say
  there are zero problem would probably be over-optimistic.

We will look at your patch soon.  You seem to change "unsigned long"
used for sizes into mp_limb_t.  That's a curious change.  I'd say that
we should typically use mp_size_t for sizes, while mp_limb_t should be
used for numerical data.  Alternatively, size_t can be used for the
former needs.


More information about the gmp-devel mailing list