[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] globsort: handle int overflow in cmp functions
From: |
Andreas Schwab |
Subject: |
Re: [PATCH] globsort: handle int overflow in cmp functions |
Date: |
Mon, 20 May 2024 19:21:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Mai 17 2024, Grisha Levit wrote:
> The current cmp implementation for size and blocks subtracts the two
> values and returns the difference as an int. This subtraction can
> overflow, and the returned int can end up having the wrong sign.
In the case of globsort_sizecmp, since off_t is wider than int, it can
return a wrong value even if the subtraction doesn't overflow.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Re: [PATCH] globsort: handle int overflow in cmp functions,
Andreas Schwab <=