CID
1232603 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
overflow_before_widen: Potentially overflowing expression
objs_per_folder * folders_range(rng) with type int (32 bits,
signed) is evaluated using 32-bit arithmetic before being
used in a context which expects an expression of type
uint64_t (64 bits, unsigned). To avoid overflow, cast
either operand to uint64_t before performing the multiplication.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
int objs_per_folder = abs(merge_threshold) * 16 * g_ceph_context->_conf->filestore_split_multiple;
boost::uniform_int<> folders_range(5, 256);
- uint64_t expected_num_objs = (uint64_t)(objs_per_folder * folders_range(rng));
+ uint64_t expected_num_objs = (uint64_t)objs_per_folder * (uint64_t)folders_range(rng);
char buf[100];
snprintf(buf, 100, "1.%x_head", pg_id);