mini-gmp: mpz_init_set_str fails on leading zeroes

Niels Möller nisse at
Mon Aug 22 19:51:28 UTC 2016

nisse at (Niels Möller) writes:

> I'm looking into this now. I'm leaning towards lettong mpn_set_str_other
> return 1 for all-zero input, and let the caller, mpz_set_str, deal with
> normalization (mpn_set_str doesn't need to, since it doesn't promise
> normalization if the input has leading zeros).
> I also found another corner case where the current implementation is
> broken: Calling mpz_set_str with an empty string as input. Have to
> check if the real gmp treats that as invalid or as zero.

I've now checked in fixes and a few new test values. Thanks for the bug


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-bugs mailing list