Re: [PATCH] strvec: use size_t to store nr and alloc
flat view
From: Philip Oakley <hidden>
Date: 2021-09-13 11:42:54
On 12/09/2021 23:00, Jeff King wrote:
On Sat, Sep 11, 2021 at 11:48:38PM +0100, Philip Oakley wrote:quoted
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.
I don't see it (root cause) as independent though. This is a nicely separated issue (effect), which helps.
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).
It's also been helpful in highlighting some of the wider issues and approaches. Thank you Philip