Overflow when usize::MAX messages have been sent
danieldg opened this issue · comments
The send_count
field is of type usize
, but is only deceremented in set_capacity
. On 32- or 16-bit platforms, it is quite reasonable to send more than usize::MAX
messages. This will overflow and either panic (if overflow checks are enabled, as in debug mode) or produce incorrect behavior.
On 64-bit platforms, it is not possible to hit this bug in a reasonable amount of time (over 100 years if items are added at 4GHz).