about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-30 02:56:47 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-30 02:56:47 -0400
commit28c5d46d844684feba2ddfc9027ea308d8d3612c (patch)
treefe917ab695dfae3277ef197376d769fb43a0a107
parente5a9b50e973aadff2e6303d01be8807b1fb9c325 (diff)
downloadmusl-28c5d46d844684feba2ddfc9027ea308d8d3612c.tar.gz
musl-28c5d46d844684feba2ddfc9027ea308d8d3612c.tar.xz
musl-28c5d46d844684feba2ddfc9027ea308d8d3612c.zip
fix off-by-one error that caused uninitialized memory read in floatscan
this caused misreading of certain floating point values that are exact
multiples of large powers of ten, unpredictable depending on prior
stack contents.
-rw-r--r--src/internal/floatscan.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c
index f80db383..4b335f5c 100644
--- a/src/internal/floatscan.c
+++ b/src/internal/floatscan.c
@@ -244,7 +244,7 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po
 
 	/* Assemble desired bits into floating point variable */
 	for (y=i=0; i<LD_B1B_DIG; i++) {
-		if ((a+i & MASK)==z) x[z=(z+1 & MASK)] = 0;
+		if ((a+i & MASK)==z) x[(z=(z+1 & MASK))-1] = 0;
 		y = 1000000000.0L * y + x[a+i & MASK];
 	}