From: Patrick Steinhardt <ps@pks.im>
To: Elia Pinto <gitter.spiros@gmail.com>
Cc: git@vger.kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/3] diff: use size_t for the allocation size of word-diff buffers
Date: Wed, 21 Oct 2026 13:24:36 +0200 [thread overview]
Message-ID: <atig9JAm_d-1CE0p@pks.im> (raw)
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
next prev parent reply other threads:[~2026-10-21 11:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 10:16 [PATCH 0/3] use size_t for a few more object and buffer sizes Elia Pinto
2026-10-21 10:16 ` [PATCH 1/3] odb: use size_t for the length of objects to write Elia Pinto
2026-10-21 11:24 ` Patrick Steinhardt
2026-10-21 10:16 ` [PATCH 2/3] diff: use size_t for the allocation size of word-diff buffers Elia Pinto
2026-10-21 11:24 ` Patrick Steinhardt [this message]
2026-10-21 10:16 ` [PATCH 3/3] convert: use size_t for buffer sizes Elia Pinto
2026-10-21 11:24 ` Patrick Steinhardt
2026-10-30 9:58 ` [PATCH v2 0/4] use size_t for a few more object and " Elia Pinto
2026-10-30 9:58 ` [PATCH v2 1/4] odb: use size_t for the length of objects to write Elia Pinto
2026-10-30 11:44 ` Patrick Steinhardt
2026-10-30 9:58 ` [PATCH v2 2/4] diff: use size_t for the allocation size of word-diff buffers Elia Pinto
2026-10-30 9:58 ` [PATCH v2 3/4] convert: use size_t for buffer sizes Elia Pinto
2026-10-30 9:58 ` [PATCH v2 4/4] convert: use size_t for text statistics and ident counts Elia Pinto
2026-10-30 11:44 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=atig9JAm_d-1CE0p@pks.im \
--to=ps@pks.im \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=gitter.spiros@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.