small fix for mpz_set_str()

Trevor Spiteri tspiteri at ieee.org
Tue Feb 13 23:43:58 UTC 2018


This is a fix for the bug
https://gmplib.org/list-archives/gmp-bugs/2018-February/004304.html

Regards.

Trevor Spiteri


diff -r 164971d5c8d0 mpz/set_str.c
--- a/mpz/set_str.c    Sat Feb 10 18:05:32 2018 +0100
+++ b/mpz/set_str.c    Wed Feb 14 00:35:11 2018 +0100
@@ -71,7 +71,9 @@
   if (c == '-')
     {
       negative = 1;
-      c = (unsigned char) *str++;
+      do
+        c = (unsigned char) *str++;
+      while (isspace (c));
     }
 
   if (digit_value[c] >= (base == 0 ? 10 : base))



More information about the gmp-devel mailing list