-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
Line 39 in 0e538fb
| let entry = unsafe { *self.table.get_unchecked((hash as usize) & self.mask) }; |
Line 50 in 0e538fb
| let e = unsafe { self.table.get_unchecked_mut((hash as usize) & self.mask) }; |
Line 83 in 0e538fb
| let e = unsafe { self.table.get_unchecked_mut((hash as usize) & self.mask) }; |
On 32-bit systems
hash as usize will overflow if the value of hash is greater than u32::MAX.
This overflow is mostly harmless in release mode (as the hash will just be truncated to the 32-bit boundary), but it will cause a panic in debug mode.
Replace (hash as usize) & self.mask with (hash & (self.mask as u64)) as usize to prevent overflow.
You may also want to change the type of self.mask to u64
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels