Commit c4a150b87e1c122f204c141c7be415046e1882fe
Committed by
Loic Dachary

1 parent
1e92f97e
Exists in
v2
gf_w64.c: fix integer overflow
Fix for Coverity issue (from Ceph): CID 1193088 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN) overflow_before_widen: Potentially overflowing expression 1 << g_s with type int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type uint64_t (64 bits, unsigned). Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de> (cherry picked from commit 1aef8694bc62a053e35cc1c74c67f1d15d8d1b6a)
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
src/gf_w64.c
... | ... | @@ -767,7 +767,7 @@ gf_w64_group_multiply(gf_t *gf, gf_val_64_t a, gf_val_64_t b) |
767 | 767 | gd = (struct gf_w64_group_data *) h->private; |
768 | 768 | gf_w64_group_set_shift_tables(gd->shift, b, h); |
769 | 769 | |
770 | - mask = ((1 << g_s) - 1); | |
770 | + mask = (((uint64_t)1 << g_s) - 1); | |
771 | 771 | top = 0; |
772 | 772 | bot = gd->shift[a&mask]; |
773 | 773 | a >>= g_s; | ... | ... |