Fix incorrect overflow test, that itself overflowed.

Nick Lewycky nlewycky at google.com
Thu Feb 9 23:23:12 UTC 2017


"(unsigned long)(x * y)" will multiply ints x and y into a new int, then
converts the int into an unsigned long. Replace it with "(unsigned long)(x)
* (unsigned long)(y)" which performs the multiplication in a larger space.

Patch attached.

Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: overflow-1.patch
Type: text/x-patch
Size: 656 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20170209/853d654b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4847 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20170209/853d654b/attachment-0001.bin>


More information about the gmp-bugs mailing list