Re: [PATCH] strvec: use size_t to store nr and alloc
From: Jeff King <hidden>
Date: 2021-09-12 22:01:01
From: Jeff King <hidden>
Date: 2021-09-12 22:01:01
On Sat, Sep 11, 2021 at 11:48:38PM +0100, Philip Oakley wrote:
I'm particularly interested in the int -> size_t change problem as part of the wider 4GB limitations for the LLP64 systems [0] such as the RaspPi, git-lfs (on windows [1]), and Git-for-Windows[2]. It is a big problem.
Note that a lot of the Windows LLP64 problems are really a separate issue. They come from a misuse of "unsigned long" as "gee, this should be big enough for anything". Most of that is due to its use for object sizes, which of course infected a whole bunch of other code. Which isn't to say it's not important. But my main goal here was making sure we use size_t for growth allocations to avoid integer overflow leading to under-allocation (and thus heap overflow). -Peff