Git development
 help / color / mirror / Atom feed
* [PATCH 0/4] use size_t when receiving and verifying packs
@ 2026-10-31 11:39 Elia Pinto
  2026-10-31 11:39 ` [PATCH 1/4] unpack-objects: use size_t for object sizes Elia Pinto
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Elia Pinto @ 2026-10-31 11:39 UTC (permalink / raw)
  To: git
  Cc: Johannes Schindelin, Elia Pinto, Justin Tobler, Han Xin, Han Xin,
	Ævar Arnfjörð Bjarmason, Patrick Steinhardt,
	Junio C Hamano, Jonathan Tan

This series continues the search for truncated sizes, this time focusing
on the side that receives and verifies packs: unpack-objects,
index-pack, and pack verification in git fsck. These components keep
object sizes as "unsigned long", while the underlying pack code already
uses size_t.

Each patch addresses a specific part of the pack pipeline:
 - 1/4 unpack-objects: on Windows, it dies when receiving an object of
   4GiB or more;
 - 2/4 index-pack write_compressed(): on all platforms ("unsigned int"),
   --fix-thin with a local base of 4GiB or more dies with "serious
   inflate inconsistency", verified by simulating at 16 bits;
 - 3/4 index-pack: on Windows, it triggers a false "SHA1 COLLISION
   FOUND" when the object already exists locally;
 - 4/4 pack-check: on Windows, "git fsck" checks a prefix of objects in
   packs.

These are all failures (die) or checks on a prefix; no corrupt data ends
up being written.

No tests are added, for the same reason as the object parsing series
(requiring 4GiB objects and 32-bit long platforms, or objects of 4GiB on
all platforms for 2/4).

This series closes the pack-verification boundary left open for
fsck_object() by the object parsing and checking series:
  https://lore.kernel.org/git/cover.1793444420.git.gitter.spiros@gmail.com/
It does not depend on other in-flight series and merges cleanly with
them. For the full effect on non-streamed objects in 1/4, the downstream
fsck_object() / parse_object_buffer() (from the series above) and
odb_write_object() (from v3 of "use size_t for a few more object and
buffer sizes") are needed as well:
  https://lore.kernel.org/git/cover.1793439137.git.gitter.spiros@gmail.com/
Pack-objects (delta search below core.bigFileThreshold) is left for a
later series.

Based on master 50fe5cc63f.

Elia Pinto (4):
  unpack-objects: use size_t for object sizes
  index-pack: use size_t in write_compressed()
  index-pack: use size_t for object sizes
  pack-check: use size_t for the size passed to verify callbacks

 builtin/fsck.c           |  2 +-
 builtin/index-pack.c     | 14 +++++++-------
 builtin/unpack-objects.c | 36 +++++++++++++++++-------------------
 odb.h                    |  2 +-
 pack.h                   |  2 +-
 5 files changed, 27 insertions(+), 29 deletions(-)


base-commit: 50fe5cc63f9cd6e89b87a2c9ccf96a444f4cfdb7
-- 
2.53.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-31 11:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-31 11:39 [PATCH 0/4] use size_t when receiving and verifying packs Elia Pinto
2026-10-31 11:39 ` [PATCH 1/4] unpack-objects: use size_t for object sizes Elia Pinto
2026-10-31 11:39 ` [PATCH 2/4] index-pack: use size_t in write_compressed() Elia Pinto
2026-10-31 11:39 ` [PATCH 3/4] index-pack: use size_t for object sizes Elia Pinto
2026-10-31 11:39 ` [PATCH 4/4] pack-check: use size_t for the size passed to verify callbacks Elia Pinto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox