mini-gmp: mpz_init_set_str fails on leading zeroes

Torbjörn Granlund tg at gmplib.org
Wed Jul 20 21:13:15 UTC 2016


Austyn Krutsinger <akrutsinger at gmail.com> writes:

  My initial though was to just skip the leading zero's in the mpz_set_str
  function by something like this:
  
    while (isspace( (unsigned char) *sp) || (*sp == '0'))
      sp++;
  
  Only problems is that this doesn't work for negative numbers that still
  have a bunch of leading zeros;
  
I think we should not accept strings like 00000-0000017.
  

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-bugs mailing list