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:
82a4499
)
fix another oob pointer arithmetic issue in printf floating point
author
Rich Felker
<dalias@aerifal.cx>
Wed, 20 Jun 2012 13:28:54 +0000
(09:28 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Wed, 20 Jun 2012 13:28:54 +0000
(09:28 -0400)
this one could never cause any problems unless the compiler/machine
goes to extra trouble to break oob pointer arithmetic, but it's best
to fix it anyway.
src/stdio/vfprintf.c
patch
|
blob
|
history
diff --git
a/src/stdio/vfprintf.c
b/src/stdio/vfprintf.c
index a3bf18dd8c6d4f4b1ef0702239664b74ca33e874..116e1cedba4be72c83dcb319d01848c6aec247a7 100644
(file)
--- a/
src/stdio/vfprintf.c
+++ b/
src/stdio/vfprintf.c
@@
-319,7
+319,7
@@
static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
if (j < 9*(z-r-1)) {
uint32_t x;
/* We avoid C's broken division of negative numbers */
- d = r + 1 + (
j+9*LDBL_MAX_EXP)/9 - LDBL_MAX_EXP
;
+ d = r + 1 + (
(j+9*LDBL_MAX_EXP)/9 - LDBL_MAX_EXP)
;
j += 9*LDBL_MAX_EXP;
j %= 9;
for (i=10, j++; j<9; i*=10, j++);