summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-06-17 22:55:57 +0000
committerUlrich Drepper <drepper@redhat.com>1998-06-17 22:55:57 +0000
commit779515aff97b8ccdb0617cc085fddcb2763ddc0d (patch)
tree76e676ba945372c59fcaba294ebf205cdf624fbe
parent0e0316f403a4ef8d00bb4c140b9191b0358ba27c (diff)
downloadglibc-779515aff97b8ccdb0617cc085fddcb2763ddc0d.tar.gz
glibc-779515aff97b8ccdb0617cc085fddcb2763ddc0d.tar.xz
glibc-779515aff97b8ccdb0617cc085fddcb2763ddc0d.zip
Update.
	* stdlib/strtod.c (str_to_mpn): Fix extending of n array which
	only should happen for cy != 0.
-rw-r--r--ChangeLog3
-rw-r--r--stdlib/strtod.c11
2 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f3c71aa166..5a1670e878 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 1998-06-17  Ulrich Drepper  <drepper@cygnus.com>
 
+	* stdlib/strtod.c (str_to_mpn): Fix extending of n array which
+	only should happen for cy != 0.
+
 	* sysdeps/unix/sysv/linux/alpha/glob.c: Include sys/types.h before
 	glob.h.
 
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index 55feca8555..154e2049d9 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -309,16 +309,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;
 	}