Re: [PATCH] strvec: use size_t to store nr and alloc
- From
Jeff King <peff@peff.net>
- Date
- Sep 12, 2021, 22:00 UTC
- Message-ID
- <YT54mskEIir2gXc2@coredump.intra.peff.net>
- In-Reply-To
- <5e5e7fd9-83d7-87f7-b1ef-1292912b6c00@iee.email>
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