diff options
author | Szabolcs Nagy <nsz@port70.net> | 2023-01-20 11:37:39 +0100 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2023-02-12 17:46:50 -0500 |
commit | 35fdfe62a4ff471074ca53b7626ec80e83d244bd (patch) | |
tree | 3afc106241abc363b5a239a1c0a58ae82a02950e /src | |
parent | 7e13e5ae69a243b90b90d2f4b79b2a150f806335 (diff) | |
download | musl-35fdfe62a4ff471074ca53b7626ec80e83d244bd.tar.gz musl-35fdfe62a4ff471074ca53b7626ec80e83d244bd.tar.bz2 musl-35fdfe62a4ff471074ca53b7626ec80e83d244bd.tar.xz musl-35fdfe62a4ff471074ca53b7626ec80e83d244bd.zip |
math: fix undefined shift in logf
A signed int shift overflowed when computing a constant mask, use hex
literal instead. This is unlikely to cause actual issues unless the
code was compiled with ubsan or similar instrumentation specifically
to catch this. The stripped libc.so is unchanged on x86_64.
Reported by q66 on irc.
Diffstat (limited to 'src')
-rw-r--r-- | src/math/logf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/math/logf.c b/src/math/logf.c index 7ee5d7fe..e4c2237c 100644 --- a/src/math/logf.c +++ b/src/math/logf.c @@ -53,7 +53,7 @@ float logf(float x) tmp = ix - OFF; i = (tmp >> (23 - LOGF_TABLE_BITS)) % N; k = (int32_t)tmp >> 23; /* arithmetic shift */ - iz = ix - (tmp & 0x1ff << 23); + iz = ix - (tmp & 0xff800000); invc = T[i].invc; logc = T[i].logc; z = (double_t)asfloat(iz); |