summaryrefslogtreecommitdiff
path: root/crt/crti.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-06-19 21:41:43 -0400
committerRich Felker <dalias@aerifal.cx>2012-06-19 21:41:43 -0400
commit914949d321448bd2189bdcbce794dbae2c8ed16e (patch)
treef764657e27f3f26006c3e096eab08a55b0214bd9 /crt/crti.c
parent25c8444919cc129264f7b7f31090d05403477719 (diff)
downloadmusl-914949d321448bd2189bdcbce794dbae2c8ed16e.tar.gz
musl-914949d321448bd2189bdcbce794dbae2c8ed16e.tar.bz2
musl-914949d321448bd2189bdcbce794dbae2c8ed16e.tar.xz
musl-914949d321448bd2189bdcbce794dbae2c8ed16e.zip
fix pointer overflow bug in floating point printf
large precision values could cause out-of-bounds pointer arithmetic in computing the precision cutoff (used to avoid expensive long-precision arithmetic when the result will be discarded). per the C standard, this is undefined behavior. one would expect that it works anyway, and in fact it did in most real-world cases, but it was randomly (depending on aslr) crashing in i386 binaries running on x86_64 kernels. this is because linux puts the userspace stack near 4GB (instead of near 3GB) when the kernel is 64-bit, leading to the out-of-bounds pointer arithmetic overflowing past the end of address space and giving a very low pointer value, which then compared lower than a pointer it should have been higher than. the new code rearranges the arithmetic so that no overflow can occur. while this bug could crash printf with memory corruption, it's unlikely to have security impact in real-world applications since the ability to provide an extremely large field precision value under attacker-control is required to trigger the bug.
Diffstat (limited to 'crt/crti.c')
0 files changed, 0 insertions, 0 deletions