diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-02-14 06:35:58 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-02-14 06:35:58 -0800 |
commit | 835fbf4248cce666199f41a118befd1063fdea2e (patch) | |
tree | ccbe843986729724e50db51497549515a48a00d1 /hash.c | |
parent | c2b2f22392e77fa98a3f71daf915ebe1a5239e99 (diff) | |
download | txr-835fbf4248cce666199f41a118befd1063fdea2e.tar.gz txr-835fbf4248cce666199f41a118befd1063fdea2e.tar.bz2 txr-835fbf4248cce666199f41a118befd1063fdea2e.zip |
Fix some issues found by ubsan.
* lib.h (num_fast): Under HAVE_UBSAN, avoid left shifting a
negative value, which is diagnosed by ubsan (by default), but
is otherwise a documented GCC extension that behaves sanely in
the manner one would expect on two's complement machines.
* mpi/mpi.c (s_mp_mul_2d): Fix instance of undefined shift
equal to the width of the type. This occurs in the case when
d == 0. In that case, we try to calculate a 32 or 64 bit full
mask by shifting 1 to the left that many times and then
subtracting 1. However, the entire code for the fractional
shift is not necessary in that case and may be skipped. I'm
also removing the unnecesary s_mp_clamp call. If the number is
clamped on entry into the function, it stays clamped.
Diffstat (limited to 'hash.c')
0 files changed, 0 insertions, 0 deletions