You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Latent shift overflow in is_public's netmask (unreachable today) #372
is_public in crates/cli/src/public_ip.rs builds a netmask with:
let mask = u32::MAX << (32 - prefix);
For prefix == 0 that is u32::MAX << 32, which is a shift overflow:
a panic in debug builds, and an unspecified result in release.
It cannot fire today. No entry in SPECIAL_USE has a prefix of 0, and
the IANA special-purpose registry has no reason to gain one. This is a trap
for whoever adds the next block, not a live defect — raised so it is written
down rather than rediscovered.
let mask = u32::MAX.checked_shl(32 - prefix).unwrap_or(0);
Found reviewing #365, which is otherwise careful here: the block list is the
IANA registry done properly, including the 192.0.0.9 and 192.0.0.10
carve-outs for PCP and TURN anycast.
Activity