mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Fix a ubsan warning in addr_mask_get_bits
ubsan doesn't like us to do (1u<<32) when 32 is wider than unsigned. Fortunately, we already special-case addr_mask_get_bits(0), so we can just change the loop bounds.
This commit is contained in:
parent
2aea6ca326
commit
dfdeb6418d
@ -1585,7 +1585,7 @@ addr_mask_get_bits(uint32_t mask)
|
||||
return 0;
|
||||
if (mask == 0xFFFFFFFFu)
|
||||
return 32;
|
||||
for (i=0; i<=32; ++i) {
|
||||
for (i=1; i<=32; ++i) {
|
||||
if (mask == (uint32_t) ~((1u<<(32-i))-1)) {
|
||||
return i;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user