]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(str_to_mpn): Fix extending of n array which only should happen for cy != 0.
authorUlrich Drepper <drepper@redhat.com>
Wed, 17 Jun 1998 22:56:48 +0000 (22:56 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 17 Jun 1998 22:56:48 +0000 (22:56 +0000)
stdlib/strtod.c

index 9aa120c87a7aa4ff3f57cccba571041aebee1a3f..67a6884545e5bcbf9a5f9853a5d52bd10a4732f3 100644 (file)
@@ -245,16 +245,21 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
       if (cnt == MAX_DIG_PER_LIMB)
        {
          if (*nsize == 0)
-           n[0] = low;
+           {
+             n[0] = low;
+             *nsize = 1;
+           }
          else
            {
              mp_limb_t cy;
              cy = __mpn_mul_1 (n, n, *nsize, MAX_FAC_PER_LIMB);
              cy += __mpn_add_1 (n, n, *nsize, low);
              if (cy != 0)
-               n[*nsize] = cy;
+               {
+                 n[*nsize] = cy;
+                 ++(*nsize);
+               }
            }
-         ++(*nsize);
          cnt = 0;
          low = 0;
        }