Skip to content

Commit edb41e4

Browse files
committed
util: use explicit cast in MultiIntBitSet::Fill()
The current code does not have a bug, but is implicitly casting -1 to 65535 and the sanitizer has no way to know whether we intend that or not. ``` FUZZ=bitset src/test/fuzz/fuzz /tmp/fuz error: implicit conversion from type 'int' of value -1 (32-bit, signed) to type 'value_type' (aka 'unsigned short') changed the value to 65535 (16-bit, unsigned) Base64: Qv7bX/8= ```
1 parent 083770a commit edb41e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/bitset.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ class MultiIntBitSet
366366
if (count) {
367367
unsigned i = 0;
368368
while (count > LIMB_BITS) {
369-
ret.m_val[i++] = ~I{0};
369+
ret.m_val[i++] = I(~I{0});
370370
count -= LIMB_BITS;
371371
}
372372
ret.m_val[i] = I(~I{0}) >> (LIMB_BITS - count);

0 commit comments

Comments
 (0)