From 1aef8694bc62a053e35cc1c74c67f1d15d8d1b6a Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Thu, 18 Jun 2015 09:00:03 +0200 Subject: 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 --- src/gf_w64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gf_w64.c b/src/gf_w64.c index c8356b8..7f9f965 100644 --- a/src/gf_w64.c +++ b/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) gd = (struct gf_w64_group_data *) h->private; gf_w64_group_set_shift_tables(gd->shift, b, h); - mask = ((1 << g_s) - 1); + mask = (((uint64_t)1 << g_s) - 1); top = 0; bot = gd->shift[a&mask]; a >>= g_s; -- cgit v1.2.1