projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e5a9b50
)
fix off-by-one error that caused uninitialized memory read in floatscan
author
Rich Felker
<dalias@aerifal.cx>
Mon, 30 Apr 2012 06:56:47 +0000
(
02:56
-0400)
committer
Rich Felker
<dalias@aerifal.cx>
Mon, 30 Apr 2012 06:56:47 +0000
(
02:56
-0400)
this caused misreading of certain floating point values that are exact
multiples of large powers of ten, unpredictable depending on prior
stack contents.
src/internal/floatscan.c
patch
|
blob
|
history
diff --git
a/src/internal/floatscan.c
b/src/internal/floatscan.c
index f80db3839ea87ec2d0513f6c4f4bb1eff0aba05e..4b335f5cf4a45b5254f4d471bb34c67501a3ca9c 100644
(file)
--- 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];
}