git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/3] use size_t for a few sizes that are 32 bits everywhere

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Nov 1, 2026, 15:36 UTC
Message-ID
<cover.1793546752.git.gitter.spiros@gmail.com>

Unlike the previous series, these aren't about "long" on Windows: the types involved ("uint32_t", "int", "unsigned int") are 32 bits on every platform. They were found by scanning a native 64-bit Linux build with -Wshorten-64-to-32. That scan sees the "unsigned long" -> 32-bit conversions that a Windows target can't see, because there "long" is already 32 bits.

- 1/3 hashwrite(): a corrupt pack when pack-objects writes a compressed
  buffer of 4GiB or more in one call;
- 2/3 count_lines(): a wrong diff -B --stat for files of 2GiB or more;
- 3/3 hash_chars(): renames of files of 4GiB or more aren't recognised.

No tests, because they need GiB-sized inputs; each was verified by simulating the truncation at 16 bits.

The other results of that scan are bounded by the format or by the input (options, masks, line lengths, xdiff limited to 1023MiB). It doesn't depend on the other series in flight and merges cleanly with them. Based on master 50fe5cc63f.

Elia Pinto (3):
  csum-file: use size_t for the count passed to hashwrite()
  diff: use size_t for the size passed to count_lines()
  diffcore-delta: use size_t for the size of the buffer to hash
 csum-file.c      | 2 +-
 csum-file.h      | 2 +-
 diff.c           | 2 +-
 diffcore-delta.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
base-commit: 50fe5cc63f9cd6e89b87a2c9ccf96a444f4cfdb7
-- 
2.53.0
Next: Elia Pinto
Message 1 of 4 in “use size_t for a few sizes that are 32 bits everywhere”
  1. 0/3 use size_t for a few sizes that are 32 bits everywhereElia Pinto, Nov 1, 2026
  2. 1/3 csum-file: use size_t for the count passed to hashwrite()Elia Pinto, Nov 1, 2026
  3. 2/3 diff: use size_t for the size passed to count_lines()Elia Pinto, Nov 1, 2026
  4. 3/3 diffcore-delta: use size_t for the size of the buffer to hashElia Pinto, Nov 1, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.