Skip to content

Commit

Permalink
Add row to rempitab table for infinity/nan edge cases (#528)
Browse files Browse the repository at this point in the history
Previously, when fetching elements from Sleef_rempitabsp
or Sleef_rempitabdp for infinity/nan inputs, we would
hit outside the table. This would trigger a global buffer
overflow error when running any of the trig functions with
an address sanitizer.
Fixes issue #464, on multiple arch. Furthermore tester3advsimd and
tester3advsimdnofma start passing when library is build with
ASAN enabled.
  • Loading branch information
joanaxcruz authored Mar 12, 2024
1 parent e520dfd commit 9ccdcff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libm/rempitab.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,7 @@ FUNCATR const double Sleef_rempitabdp[] = {
2.1353977370878701046e-273, -1.2215123283371736879e-289, 6.7342163555358599277e-306, -5.681754927174335258e-322,
2.1353977370878701046e-273, -1.2215123283371736879e-289, 6.7342163555358599277e-306, -5.681754927174335258e-322,
2.8687869620228451614e-274, -1.9537812801257956865e-290, 1.0380272777574237546e-306, 6.4228533959362050743e-323,
0, 0, 0, 0,
};

NOEXPORT ALIGNED(64) const float Sleef_rempitabsp[] = {
Expand Down Expand Up @@ -1087,4 +1088,5 @@ NOEXPORT ALIGNED(64) const float Sleef_rempitabsp[] = {
1.183823005e-12, 1.161414894e-20, 1.29131908e-27, 1.715766248e-34,
1.183823005e-12, 1.161414894e-20, 1.29131908e-27, 1.715766248e-34,
2.743283031e-13, 1.161414894e-20, 1.29131908e-27, 1.715766248e-34,
0, 0, 0, 0,
};

0 comments on commit 9ccdcff

Please sign in to comment.