mirror of
https://git.musl-libc.org/git/musl
synced 2026-01-26 08:07:52 +00:00
commit 572a2e2eb91f00f2f25d301cfb50f435e7ae16b3 adjusted the buffer for decimal conversion to be a VLA that only uses the full size needed for long double when the argument type was long double. however, it failed to update a later expression for the positioning within the buffer, which still used a fixed offset of LDBL_MANT_DIG. this caused doubles with a large positive exponent to overflow below the start of the array, producing wrong output and potentially runaway wrong execution. this bug has not been present in any release, and has not been analyzed in depth for security considerations. it turns out the original buffer offset expression involving LDBL_MANT_DIG was incorrect as well, and only worked because the space reserved for expanding the exponent is roughly 3 times the size it needs to be when the exponent is positive, leaving plenty of extra space to compensate for the error. the actual offset should be in base-1000000000 slot units, not bits, and numerically equal to the number of slots that were previously allocated for mantissa expansion. in order to ensure consistency and make the code more comprehensible, commented subexpressions are replaced by intermediate named variables, and the newly introduced max_mant_slots is used for both the allocation and the buffer offset adjustment. the included +1 term accounts for a trailing zero slot that's always emitted.
musl libc
musl, pronounced like the word "mussel", is an MIT-licensed
implementation of the standard C library targetting the Linux syscall
API, suitable for use in a wide range of deployment environments. musl
offers efficient static and dynamic linking support, lightweight code
and low runtime overhead, strong fail-safe guarantees under correct
usage, and correctness in the sense of standards conformance and
safety. musl is built on the principle that these goals are best
achieved through simple code that is easy to understand and maintain.
The 1.1 release series for musl features coverage for all interfaces
defined in ISO C99 and POSIX 2008 base, along with a number of
non-standardized interfaces for compatibility with Linux, BSD, and
glibc functionality.
For basic installation instructions, see the included INSTALL file.
Information on full musl-targeted compiler toolchains, system
bootstrapping, and Linux distributions built on musl can be found on
the project website:
http://www.musl-libc.org/
Description
Languages
C
93.1%
Assembly
4.8%
C++
1.3%
Awk
0.4%
Makefile
0.3%
Other
0.1%