On 12/5/25 8:47 AM, Joel Fernandes wrote:
> On 12/3/2025 12:59 AM, John Hubbard wrote:
...
>> +        // TAIL points at last DWORD written, so add 4 to get total size
>> +        (tail - head) + 4
>> +    }
>> +
> 
> Can we harden against integer underflow here? Even if tail is always >= head 
> in
> normal operation, I think we should prepare for underflow due to misbehaving 
> HW
> etc to avoid producing a massive integer, how about:
> 
>     tail.saturating_sub(head) + 4

Yes. Fixed in the next version, thanks for spotting that.

thanks,
-- 
John Hubbard

Reply via email to