Commit 98e5e37159f4c7634305aa65c9bc98a36488a4a9
1 parent
7972291e
Exists in
master
and in
1 other branch
gf_w64.c: fix integer overflow
Fix for Coverity issue (from Ceph): CID 1193086 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN) overflow_before_widen: Potentially overflowing expression 1 << g_r 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>
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
src/gf_w64.c
... | ... | @@ -994,7 +994,7 @@ int gf_w64_group_init(gf_t *gf) |
994 | 994 | gd->reduce = gd->shift + (1 << g_s); |
995 | 995 | |
996 | 996 | gd->reduce[0] = 0; |
997 | - for (i = 0; i < (1 << g_r); i++) { | |
997 | + for (i = 0; i < ((uint64_t)1 << g_r); i++) { | |
998 | 998 | p = 0; |
999 | 999 | index = 0; |
1000 | 1000 | for (j = 0; j < g_r; j++) { | ... | ... |