[PATCH v3 09/13] diff: widen `deflate_it()`'s bound local from int to `size_t`
- From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Aug 13, 2026, 14:55 UTC
- Message-ID
- <f0765f6ed6c13c6942f2ae76e5d4065eeb2ef8ce.1786632952.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.2175.v3.git.1786632952.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Fixes a pre-existing silent narrowing from `git_deflate_bound()`'s `unsigned long` return into an `int` local: anything past 2 GiB has always wrapped negative here and then been re-extended to `size_t` inside `xmalloc()`. Also prep for the upcoming `git_deflate_bound()` widening to `size_t`, which would extend the narrowing further if `bound` stayed `int`.
Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/diff.c b/diff.c index 69eb2f76a4..c14f69719b 100644 --- a/diff.c +++ b/diff.c @@ -3609,7 +3609,7 @@ static unsigned char *deflate_it(char *data, unsigned long size, unsigned long *result_size) { - int bound; + size_t bound; unsigned char *deflated; git_zstream stream; struct repo_config_values *cfg = repo_config_values(the_repository);
-- gitgitgadget