Re: [PATCH] unix/hostdisk: Fix signed integer overflow

2025-06-05 Thread Daniel Kiper via Grub-devel
On Thu, Jun 05, 2025 at 05:03:19AM +, Lidong Chen wrote: > The potential overflow issue arises at "size += ret;" because 'size' > is of type ssize_t (signed) while 'len' is size_t (unsigned). Repeatedly > adding read sizes ('ret') to 'size' can potentially exceed the maximum > value of ssize_t,

[PATCH] unix/hostdisk: Fix signed integer overflow

2025-06-04 Thread Lidong Chen via Grub-devel
The potential overflow issue arises at "size += ret;" because 'size' is of type ssize_t (signed) while 'len' is size_t (unsigned). Repeatedly adding read sizes ('ret') to 'size' can potentially exceed the maximum value of ssize_t, causing it to overflow into a negative or incorrect value. The fix i