mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
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.
This commit is contained in:
parent
7e13e5ae69
commit
35fdfe62a4
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue