From: Patrick Steinhardt Date: Wed, 21 Oct 2026 11:24:36 GMT Subject: Re: [PATCH 2/3] diff: use size_t for the allocation size of word-diff buffers Message-ID: In-Reply-To: <20261021101640.329990-3-gitter.spiros@gmail.com> On Wed, Oct 21, 2026 at 12:16:38PM +0200, Elia Pinto wrote: > diff --git a/diff.c b/diff.c > index b4ac17f8ef..9483931c05 100644 > --- a/diff.c > +++ b/diff.c > @@ -1959,7 +1959,7 @@ static void emit_rewrite_diff(const char *name_a, > > struct diff_words_buffer { > mmfile_t text; > - unsigned long alloc; > + size_t alloc; > struct diff_words_orig { > const char *begin, *end; > } *orig; > @@ -2192,7 +2192,7 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out, > regex_t *word_regex) > { > int i, j; > - long alloc = 0; > + size_t alloc = 0; This is especially offending. I double checked that we really don't make use of a potential negative value, but all this is ever used for is `ALLOC_GROW()`. Patrick