{"thread":{"id":"66728","subject":"[PATCH 0/4] use size_t when receiving and verifying packs","startedAt":"2026-10-31T11:39:34Z","lastAt":"2026-11-19T17:48:53Z","messageCount":20,"participants":["Elia Pinto","Patrick Steinhardt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"557016","messageId":"cover.1793446357.git.gitter.spiros@gmail.com","threadId":"66728","inReplyTo":null,"subject":"[PATCH 0/4] use size_t when receiving and verifying packs","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-10-31T11:39:34Z","receivedAt":"2026-10-31T11:39:34Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"This series continues the search for truncated sizes, this time focusing\non the side that receives and verifies packs: unpack-objects,\nindex-pack, and pack verification in git fsck. These components keep\nobject sizes as \"unsigned long\", while the underlying pack code already\nuses size_t.\n\nEach patch addresses a specific part of the pack pipeline:\n - 1/4 unpack-objects: on Windows, it dies when receiving an object of\n   4GiB or more;\n - 2/4 index-pack write_compressed(): on all platforms (\"unsigned int\"),\n   --fix-thin with a local base of 4GiB or more dies with \"serious\n   inflate inconsistency\", verified by simulating at 16 bits;\n - 3/4 index-pack: on Windows, it triggers a false \"SHA1 COLLISION\n   FOUND\" when the object already exists locally;\n - 4/4 pack-check: on Windows, \"git fsck\" checks a prefix of objects in\n   packs.\n\nThese are all failures (die) or checks on a prefix; no corrupt data ends\nup being written.\n\nNo tests are added, for the same reason as the object parsing series\n(requiring 4GiB objects and 32-bit long platforms, or objects of 4GiB on\nall platforms for 2/4).\n\nThis series closes the pack-verification boundary left open for\nfsck_object() by the object parsing and checking series:\n  https://lore.kernel.org/git/cover.1793444420.git.gitter.spiros@gmail.com/\nIt does not depend on other in-flight series and merges cleanly with\nthem. For the full effect on non-streamed objects in 1/4, the downstream\nfsck_object() / parse_object_buffer() (from the series above) and\nodb_write_object() (from v3 of \"use size_t for a few more object and\nbuffer sizes\") are needed as well:\n  https://lore.kernel.org/git/cover.1793439137.git.gitter.spiros@gmail.com/\nPack-objects (delta search below core.bigFileThreshold) is left for a\nlater series.\n\nBased on master 50fe5cc63f.\n\nElia Pinto (4):\n  unpack-objects: use size_t for object sizes\n  index-pack: use size_t in write_compressed()\n  index-pack: use size_t for object sizes\n  pack-check: use size_t for the size passed to verify callbacks\n\n builtin/fsck.c           |  2 +-\n builtin/index-pack.c     | 14 +++++++-------\n builtin/unpack-objects.c | 36 +++++++++++++++++-------------------\n odb.h                    |  2 +-\n pack.h                   |  2 +-\n 5 files changed, 27 insertions(+), 29 deletions(-)\n\n\nbase-commit: 50fe5cc63f9cd6e89b87a2c9ccf96a444f4cfdb7\n-- \n2.53.0\n\n\n"},{"id":"557017","messageId":"f259eeb6a6432e20a541e94d8496f9f8299d7bdd.1793446357.git.gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"cover.1793446357.git.gitter.spiros@gmail.com","subject":"[PATCH 1/4] unpack-objects: use size_t for object sizes","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-10-31T11:39:35Z","receivedAt":"2026-10-31T11:39:35Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"builtin/unpack-objects.c uses \"unsigned long\" to track object sizes\nthroughout the file, while sizes read from packs are handled as size_t.\nOn platforms where \"long\" is 32 bits, this truncates the size for\nobjects of 4GiB or more.\n\nWhen handling large objects on those platforms, unpack-objects fails\nrather than corrupting data. For instance, streaming large blobs\n(exceeding core.bigFileThreshold) passes a truncated size to\nstream_blob(), causing the stream write to fail with an error.\n\nUse size_t across the board in builtin/unpack-objects.c and remove the\nnow-unnecessary size cast in unpack_delta_entry(). Downstream consumers\nlike odb_write_object() and fsck_object() are updated separately.\n\nTriggering this requires processing 4GiB or more of input on a platform\nwhere \"long\" is 32 bits, so no test is added.\n\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n builtin/unpack-objects.c | 36 +++++++++++++++++-------------------\n 1 file changed, 17 insertions(+), 19 deletions(-)\n\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 351948724a..6c830a606f 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -40,7 +40,7 @@ static struct progress *progress;\n  */\n struct obj_buffer {\n \tchar *buffer;\n-\tunsigned long size;\n+\tsize_t size;\n };\n \n static struct decoration obj_decorate;\n@@ -50,7 +50,7 @@ static struct obj_buffer *lookup_object_buffer(struct object *base)\n \treturn lookup_decoration(&obj_decorate, base);\n }\n \n-static void add_object_buffer(struct object *object, char *buffer, unsigned long size)\n+static void add_object_buffer(struct object *object, char *buffer, size_t size)\n {\n \tstruct obj_buffer *obj;\n \tCALLOC_ARRAY(obj, 1);\n@@ -114,10 +114,10 @@ static void use(int bytes)\n  * allocated buffer which is reused to hold temporary zstream output\n  * and return NULL instead of returning garbage data.\n  */\n-static void *get_data(unsigned long size)\n+static void *get_data(size_t size)\n {\n \tgit_zstream stream;\n-\tunsigned long bufsize = dry_run && size > 8192 ? 8192 : size;\n+\tsize_t bufsize = dry_run && size > 8192 ? 8192 : size;\n \tvoid *buf = xmallocz(bufsize);\n \n \tmemset(&stream, 0, sizeof(stream));\n@@ -161,7 +161,7 @@ struct delta_info {\n \tstruct object_id base_oid;\n \tunsigned nr;\n \toff_t base_offset;\n-\tunsigned long size;\n+\tsize_t size;\n \tvoid *delta;\n \tstruct delta_info *next;\n };\n@@ -170,7 +170,7 @@ static struct delta_info *delta_list;\n \n static void add_delta_to_list(unsigned nr, const struct object_id *base_oid,\n \t\t\t      off_t base_offset,\n-\t\t\t      void *delta, unsigned long size)\n+\t\t\t      void *delta, size_t size)\n {\n \tstruct delta_info *info = xmalloc(sizeof(*info));\n \n@@ -261,7 +261,7 @@ static void write_rest(void)\n }\n \n static void added_object(unsigned nr, enum object_type type,\n-\t\t\t void *data, unsigned long size);\n+\t\t\t void *data, size_t size);\n \n /*\n  * Write out nr-th object from the list, now we know the contents\n@@ -269,7 +269,7 @@ static void added_object(unsigned nr, enum object_type type,\n  * to be checked at the end.\n  */\n static void write_object(unsigned nr, enum object_type type,\n-\t\t\t void *buf, unsigned long size)\n+\t\t\t void *buf, size_t size)\n {\n \tif (!strict) {\n \t\tif (odb_write_object(the_repository->objects, buf, size, type,\n@@ -310,8 +310,8 @@ static void write_object(unsigned nr, enum object_type type,\n }\n \n static void resolve_delta(unsigned nr, enum object_type type,\n-\t\t\t  void *base, unsigned long base_size,\n-\t\t\t  void *delta, unsigned long delta_size)\n+\t\t\t  void *base, size_t base_size,\n+\t\t\t  void *delta, size_t delta_size)\n {\n \tvoid *result;\n \tsize_t result_size;\n@@ -330,7 +330,7 @@ static void resolve_delta(unsigned nr, enum object_type type,\n  * resolve all the deltified objects that are based on it.\n  */\n static void added_object(unsigned nr, enum object_type type,\n-\t\t\t void *data, unsigned long size)\n+\t\t\t void *data, size_t size)\n {\n \tstruct delta_info **p = &delta_list;\n \tstruct delta_info *info;\n@@ -349,7 +349,7 @@ static void added_object(unsigned nr, enum object_type type,\n \t}\n }\n \n-static void unpack_non_delta_entry(enum object_type type, unsigned long size,\n+static void unpack_non_delta_entry(enum object_type type, size_t size,\n \t\t\t\t   unsigned nr)\n {\n \tvoid *buf = get_data(size);\n@@ -386,7 +386,7 @@ static ssize_t zlib_stream_read(struct odb_stream *in_stream,\n \treturn buf_len - zstream->avail_out;\n }\n \n-static void stream_blob(unsigned long size, unsigned nr)\n+static void stream_blob(size_t size, unsigned nr)\n {\n \tgit_zstream zstream = { 0 };\n \tstruct zlib_stream in_stream = {\n@@ -420,7 +420,7 @@ static void stream_blob(unsigned long size, unsigned nr)\n }\n \n static int resolve_against_held(unsigned nr, const struct object_id *base,\n-\t\t\t\tvoid *delta_data, unsigned long delta_size)\n+\t\t\t\tvoid *delta_data, size_t delta_size)\n {\n \tstruct object *obj;\n \tstruct obj_buffer *obj_buffer;\n@@ -435,12 +435,11 @@ static int resolve_against_held(unsigned nr, const struct object_id *base,\n \treturn 1;\n }\n \n-static void unpack_delta_entry(enum object_type type, unsigned long delta_size,\n+static void unpack_delta_entry(enum object_type type, size_t delta_size,\n \t\t\t       unsigned nr)\n {\n \tvoid *delta_data, *base;\n-\tunsigned long base_size;\n-\tsize_t base_size_st = 0;\n+\tsize_t base_size = 0;\n \tstruct object_id base_oid;\n \n \tif (type == OBJ_REF_DELTA) {\n@@ -517,8 +516,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,\n \t\treturn;\n \n \tbase = odb_read_object(the_repository->objects, &base_oid,\n-\t\t\t       &type, &base_size_st);\n-\tbase_size = cast_size_t_to_ulong(base_size_st);\n+\t\t\t       &type, &base_size);\n \tif (!base) {\n \t\terror(\"failed to read delta-pack base object %s\",\n \t\t      oid_to_hex(&base_oid));\n-- \n2.53.0\n\n\n"},{"id":"557018","messageId":"438f7c6ba2ed76a782b8af6f5bc1edab1f3fb73f.1793446357.git.gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"cover.1793446357.git.gitter.spiros@gmail.com","subject":"[PATCH 2/4] index-pack: use size_t in write_compressed()","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-10-31T11:39:36Z","receivedAt":"2026-10-31T11:39:36Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"write_compressed() in builtin/index-pack.c takes the object size as an\n\"unsigned int\" and returns an \"int\", which are 32 bits wide on all\nplatforms. It is used by append_obj_to_pack() when resolving thin packs\nwith --fix-thin.\n\nWith a local base of 4GiB or more, write_compressed() compresses only\nthe first \"size mod 2^32\" bytes, while the pack header written by\nappend_obj_to_pack() records the full size. Later, when resolving deltas\nagainst that base, unpack_data() encounters an early end of stream and\ndies with \"serious inflate inconsistency\". Shrinking the parameter to 16\nbits and using a 100KiB base makes \"git index-pack --fix-thin\" die the\nsame way.\n\nUse size_t for both the size parameter and the return value.\n\nTriggering this requires processing a local base of 4GiB or more, so\nno test is added.\n\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n builtin/index-pack.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 0264c18c5f..f65228468b 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -1411,7 +1411,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha\n \t\t    nr_ofs_deltas + nr_ref_deltas - nr_resolved_deltas);\n }\n \n-static int write_compressed(struct hashfile *f, void *in, unsigned int size)\n+static size_t write_compressed(struct hashfile *f, void *in, size_t size)\n {\n \tgit_zstream stream;\n \tint status;\n-- \n2.53.0\n\n\n"},{"id":"557019","messageId":"02582827457e53b61548f544f57fd7f4044e725e.1793446357.git.gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"cover.1793446357.git.gitter.spiros@gmail.com","subject":"[PATCH 3/4] index-pack: use size_t for object sizes","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-10-31T11:39:37Z","receivedAt":"2026-10-31T11:39:37Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"Functions like sha1_object() and append_obj_to_pack() in\nbuiltin/index-pack.c take object sizes as an \"unsigned long\", even\nthough struct object_entry already tracks them as size_t. On platforms\nwhere \"long\" is 32 bits, this truncates the size for objects of 4GiB or\nmore.\n\nWhen receiving, on those platforms, a large object that already exists\nlocally, sha1_object() compares the real size (size_t) against the\ntruncated size, resulting in a false \"SHA1 COLLISION FOUND\" error and\naborting index-pack.\n\nUse size_t for the size parameter across these functions.\n\nTriggering this requires processing 4GiB or more of input on a platform\nwhere \"long\" is 32 bits, so no test is added.\n\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n builtin/index-pack.c | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex f65228468b..d4c073654d 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -588,7 +588,7 @@ static void *unpack_raw_entry(struct object_entry *obj,\n }\n \n static void *unpack_data(struct object_entry *obj,\n-\t\t\t int (*consume)(const unsigned char *, unsigned long, void *),\n+\t\t\t int (*consume)(const unsigned char *, size_t, void *),\n \t\t\t void *cb_data)\n {\n \toff_t from = obj[0].idx.offset + obj[0].hdr_size;\n@@ -765,10 +765,10 @@ struct compare_data {\n \tstruct object_entry *entry;\n \tstruct odb_stream *st;\n \tunsigned char *buf;\n-\tunsigned long buf_size;\n+\tsize_t buf_size;\n };\n \n-static int compare_objects(const unsigned char *buf, unsigned long size,\n+static int compare_objects(const unsigned char *buf, size_t size,\n \t\t\t   void *cb_data)\n {\n \tstruct compare_data *data = cb_data;\n@@ -881,7 +881,7 @@ static void do_record_outgoing_links(struct object *obj)\n }\n \n static void sha1_object(const void *data, struct object_entry *obj_entry,\n-\t\t\tunsigned long size, enum object_type type,\n+\t\t\tsize_t size, enum object_type type,\n \t\t\tconst struct object_id *oid)\n {\n \tvoid *new_data = NULL;\n@@ -1438,11 +1438,11 @@ static size_t write_compressed(struct hashfile *f, void *in, size_t size)\n \n static struct object_entry *append_obj_to_pack(struct hashfile *f,\n \t\t\t       const unsigned char *sha1, void *buf,\n-\t\t\t       unsigned long size, enum object_type type)\n+\t\t\t       size_t size, enum object_type type)\n {\n \tstruct object_entry *obj = &objects[nr_objects++];\n \tunsigned char header[10];\n-\tunsigned long s = size;\n+\tsize_t s = size;\n \tint n = 0;\n \tunsigned char c = (type << 4) | (s & 15);\n \ts >>= 4;\n-- \n2.53.0\n\n\n"},{"id":"557020","messageId":"87b0d2bd96ad2e62f770c556eca9589bf7aad11c.1793446357.git.gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"cover.1793446357.git.gitter.spiros@gmail.com","subject":"[PATCH 4/4] pack-check: use size_t for the size passed to verify callbacks","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-10-31T11:39:38Z","receivedAt":"2026-10-31T11:39:38Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"verify_pack() in pack-check.c passes each object to a verify_fn callback\n(defined in pack.h) taking the object size as an \"unsigned long\", even\nthough pack-check already handles it as a size_t. This signature is also\nreplicated in struct odb_fsck_options (odb.h) and implemented by\nfsck_obj_buffer() in builtin/fsck.c.\n\nOn platforms where \"long\" is 32 bits, running \"git fsck\" on packs with\nobjects of 4GiB or more passes a truncated size to fsck_obj_buffer(),\ncausing parse_object_buffer() and fsck_object() to inspect only a\nprefix.\n\nUse size_t for the size parameter in verify_fn,\nstruct odb_fsck_options.object_cb, and fsck_obj_buffer().\n\nTriggering this requires processing objects of 4GiB or more on a\nplatform where \"long\" is 32 bits, so no test is added.\n\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n builtin/fsck.c | 2 +-\n odb.h          | 2 +-\n pack.h         | 2 +-\n 3 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex da90cf84bf..9f62aa1f4e 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -390,7 +390,7 @@ static void check_connectivity(struct repository *repo)\n }\n \n static int fsck_obj_buffer(const struct object_id *oid, enum object_type type,\n-\t\t\t   unsigned long size, void *buffer, int *eaten, void *cb_data)\n+\t\t\t   size_t size, void *buffer, int *eaten, void *cb_data)\n {\n \tstruct repository *repo = cb_data;\n \tstruct object *obj;\ndiff --git a/odb.h b/odb.h\nindex dd85b880a7..9cb36ed5ad 100644\n--- a/odb.h\n+++ b/odb.h\n@@ -197,7 +197,7 @@ struct odb_fsck_options {\n \tenum odb_fsck_flags flags;\n \n \tint (*object_cb)(const struct object_id *oid, enum object_type type,\n-\t\t\t unsigned long size, void *buffer, int *eaten, void *cb_data);\n+\t\t\t size_t size, void *buffer, int *eaten, void *cb_data);\n \tvoid *object_payload;\n };\n \ndiff --git a/pack.h b/pack.h\nindex ada506b5c5..d9649c6ee0 100644\n--- a/pack.h\n+++ b/pack.h\n@@ -88,7 +88,7 @@ struct progress;\n /* Note, the data argument could be NULL if object type is blob */\n typedef int (*verify_fn)(const struct object_id *oid,\n \t\t\t enum object_type type,\n-\t\t\t unsigned long size,\n+\t\t\t size_t size,\n \t\t\t void *buffer, int *eaten,\n \t\t\t void *fn_data);\n \n-- \n2.53.0\n\n\n"},{"id":"558673","messageId":"cover.1794984184.git.gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"cover.1793446357.git.gitter.spiros@gmail.com","subject":"[PATCH v2 0/4] use size_t when receiving and verifying packs","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-11-18T06:56:34Z","receivedAt":"2026-11-18T06:56:34Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"This series fixes object sizes that are truncated when receiving and\nverifying packs. Most of them are kept in an \"unsigned long\", which is\na problem where \"long\" is 32 bits while size_t is 64, such as on 64-bit\nWindows; 2/4 is about an \"unsigned int\", which is 32 bits everywhere.\n\n 1/4 unpack-objects fails with \"inflate returned -5\" on an object of\n     4GiB or more that is not streamed, dies on a delta base that\n     large, and silently writes a truncated object for a delta result\n     that large. With 1/4, \"unpack-objects -n\" and large delta bases\n     work, and writing such an object, unless it is streamed, dies\n     with a clear error.\n\n 2/4 \"index-pack --fix-thin\" with a local base of 4GiB or more\n     compresses only part of it and dies later with \"serious inflate\n     inconsistency\" (all platforms).\n\n 3/4 index-pack reports a false \"SHA1 COLLISION FOUND\" for a large\n     object that already exists locally.\n\n 4/4 \"git fsck\" checks only a prefix of large objects in packs.\n\nNone of them comes with a test, as each needs an object of 4GiB or\nmore; 1/4 and 2/4 describe how I checked them with the size truncated\nto 16 bits.\n\nChanges since v1:\n\n - Rebased onto master at e1ec09b23c (The 22nd batch). v1's 1/4 no\n   longer applied: e07ac16d1c (unpack-objects: pass the size of a\n   streamed blob as size_t, 2026-11-06) by Kristofer Karlsson, now in\n   master, makes the same change to stream_blob(). 1/4 drops that hunk;\n   Kristofer is Cc'd.\n\n - The message of 1/4 used stream_blob() as its only example, so it is\n   rewritten around the paths that are still affected: objects that\n   are not streamed, all blobs with \"git unpack-objects -n\", and\n   deltas.\n\n - 1/4 no longer drops the cast_size_t_to_ulong() in\n   unpack_delta_entry(), but moves it to write_object(), where the size\n   is passed to odb_write_object() and parse_object_buffer(). v1 let\n   objects of 4GiB or more reach these functions and be written\n   truncated.\n\n - 4/4 says that parse_object_buffer() and fsck_object() still see a\n   truncated size until they take a size_t.\n\n - The messages of 1/4, 3/4 and 4/4 now say that the problem is \"long\"\n   being 32 bits while size_t is 64. The code of 2/4, 3/4 and 4/4 is\n   unchanged.\n\nThere were no comments on v1.\n\nv1 left pack-objects for a later series. That fix has since been\nmerged as ep/pack-objects-streamed-large-blobs-fix (ed0aed1e17); it\ncovers the streamed path and explains why the other truncations in\npack-objects cannot be reached.\n\nThe callees odb_write_object(), parse_object_buffer() and\nfsck_object() still take an \"unsigned long\" on master. They are changed\nby two other series of mine, which are not queued yet:\n\n  https://lore.kernel.org/git/cover.1793444420.git.gitter.spiros@gmail.com/\n  https://lore.kernel.org/git/cover.1793439137.git.gitter.spiros@gmail.com/\n\nThe series is based on master at e1ec09b23c.\n\nElia Pinto (4):\n  unpack-objects: use size_t for object sizes\n  index-pack: use size_t in write_compressed()\n  index-pack: use size_t for object sizes\n  pack-check: use size_t for the size passed to verify callbacks\n\n builtin/fsck.c           |  2 +-\n builtin/index-pack.c     | 14 +++++++-------\n builtin/unpack-objects.c | 42 ++++++++++++++++++++--------------------\n odb.h                    |  2 +-\n pack.h                   |  2 +-\n 5 files changed, 31 insertions(+), 31 deletions(-)\n\nRange-diff against v1:\n1:  f259eeb6a6 ! 1:  b2c3d349a4 unpack-objects: use size_t for object sizes\n    @@ Metadata\n      ## Commit message ##\n         unpack-objects: use size_t for object sizes\n     \n    -    builtin/unpack-objects.c uses \"unsigned long\" to track object sizes\n    -    throughout the file, while sizes read from packs are handled as size_t.\n    -    On platforms where \"long\" is 32 bits, this truncates the size for\n    -    objects of 4GiB or more.\n    +    Since f2063855fb (index-pack, unpack-objects: use size_t for object\n    +    size, 2026-05-08), unpack_one() decodes the size of an object into a\n    +    size_t, and e07ac16d1c (unpack-objects: pass the size of a streamed\n    +    blob as size_t, 2026-11-06) passes it on as such to stream_blob(),\n    +    which handles blobs larger than core.bigFileThreshold. The rest of\n    +    builtin/unpack-objects.c still takes the size as an \"unsigned long\":\n     \n    -    When handling large objects on those platforms, unpack-objects fails\n    -    rather than corrupting data. For instance, streaming large blobs\n    -    (exceeding core.bigFileThreshold) passes a truncated size to\n    -    stream_blob(), causing the stream write to fail with an error.\n    +     - unpack_non_delta_entry() and get_data(), used for commits, trees,\n    +       tags and blobs below core.bigFileThreshold, and for all blobs with\n    +       \"git unpack-objects -n\", which never streams;\n     \n    -    Use size_t across the board in builtin/unpack-objects.c and remove the\n    -    now-unnecessary size cast in unpack_delta_entry(). Downstream consumers\n    -    like odb_write_object() and fsck_object() are updated separately.\n    +     - unpack_delta_entry() and the functions that keep and resolve\n    +       deltas;\n     \n    -    Triggering this requires processing 4GiB or more of input on a platform\n    -    where \"long\" is 32 bits, so no test is added.\n    +     - struct obj_buffer, which keeps objects around for --strict.\n    +\n    +    On platforms where \"long\" is 32 bits while size_t is 64, such as 64-bit\n    +    Windows, the size of an object of 4GiB or more is therefore truncated:\n    +\n    +     - For an object that is not streamed, get_data() allocates a buffer\n    +       of the truncated size, inflate runs out of room in it, and\n    +       unpack-objects fails with \"inflate returned -5\". Truncating the\n    +       size to 16 bits in get_data() and unpack_non_delta_entry()\n    +       reproduces this with a pack holding a 70000-byte blob, both with\n    +       and without -n.\n    +\n    +     - unpack_delta_entry() reads the base of a delta through\n    +       cast_size_t_to_ulong(), so a base of 4GiB or more makes it die even\n    +       when the result would be smaller.\n    +\n    +     - The result of a delta reaches write_object() as a size_t, but\n    +       write_object() takes it as an \"unsigned long\". A result of 4GiB or\n    +       more is silently truncated there, and an object with the wrong\n    +       contents, hence the wrong name, is written.\n    +\n    +    Use size_t across builtin/unpack-objects.c. The functions that\n    +    write_object() hands objects to, odb_write_object() and\n    +    parse_object_buffer(), still take an \"unsigned long\", as does\n    +    fsck_object(); they are updated separately. Until then, move the size\n    +    cast from unpack_delta_entry() to write_object(), where the size is\n    +    passed to them. fsck_object() only sees objects that went through\n    +    parse_object_buffer() first, and so does write_cached_object(), which\n    +    writes them out later; neither needs a cast of its own.\n    +\n    +    As a result, on those platforms:\n    +\n    +     - \"git unpack-objects -n\" handles objects of any size;\n    +\n    +     - a delta with a base of 4GiB or more and a smaller result is\n    +       resolved;\n    +\n    +     - an object of 4GiB or more that is not streamed and has to be\n    +       written, including the result of a delta, makes unpack-objects die\n    +       with \"object too large to read on this platform\" instead of failing\n    +       with \"inflate returned -5\" or being written truncated.\n    +\n    +    Truncating the size to 16 bits where write_object() passes it on\n    +    confirms the last point for a 70000-byte blob: with the cast,\n    +    unpack-objects dies with \"object too large to read on this platform:\n    +    70000 is cut off to 4464\"; without it, it exits with 0 and writes a\n    +    truncated blob under another name.\n    +\n    +    Triggering this requires processing an object of 4GiB or more on a\n    +    platform where \"long\" is 32 bits while size_t is 64, so no test is\n    +    added.\n     \n         Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>\n     \n    @@ builtin/unpack-objects.c: static void added_object(unsigned nr, enum object_type\n     +\t\t\t void *buf, size_t size)\n      {\n      \tif (!strict) {\n    - \t\tif (odb_write_object(the_repository->objects, buf, size, type,\n    +-\t\tif (odb_write_object(the_repository->objects, buf, size, type,\n    ++\t\tif (odb_write_object(the_repository->objects, buf,\n    ++\t\t\t\t     cast_size_t_to_ulong(size), type,\n    + \t\t\t\t     &obj_list[nr].oid) < 0)\n    + \t\t\tdie(\"failed to write object\");\n    + \t\tadded_object(nr, type, buf, size);\n    +@@ builtin/unpack-objects.c: static void write_object(unsigned nr, enum object_type type,\n    + \t\tobj_list[nr].obj = NULL;\n    + \t} else if (type == OBJ_BLOB) {\n    + \t\tstruct blob *blob;\n    +-\t\tif (odb_write_object(the_repository->objects, buf, size, type,\n    ++\t\tif (odb_write_object(the_repository->objects, buf,\n    ++\t\t\t\t     cast_size_t_to_ulong(size), type,\n    + \t\t\t\t     &obj_list[nr].oid) < 0)\n    + \t\t\tdie(\"failed to write object\");\n    + \t\tadded_object(nr, type, buf, size);\n    +@@ builtin/unpack-objects.c: static void write_object(unsigned nr, enum object_type type,\n    + \t\t\t\t &obj_list[nr].oid);\n    + \t\tadded_object(nr, type, buf, size);\n    + \t\tobj = parse_object_buffer(the_repository, &obj_list[nr].oid,\n    +-\t\t\t\t\t  type, size, buf,\n    ++\t\t\t\t\t  type, cast_size_t_to_ulong(size), buf,\n    + \t\t\t\t\t  &eaten);\n    + \t\tif (!obj)\n    + \t\t\tdie(\"invalid %s\", type_name(type));\n     @@ builtin/unpack-objects.c: static void write_object(unsigned nr, enum object_type type,\n      }\n      \n    @@ builtin/unpack-objects.c: static void added_object(unsigned nr, enum object_type\n      \t\t\t\t   unsigned nr)\n      {\n      \tvoid *buf = get_data(size);\n    -@@ builtin/unpack-objects.c: static ssize_t zlib_stream_read(struct odb_stream *in_stream,\n    - \treturn buf_len - zstream->avail_out;\n    - }\n    - \n    --static void stream_blob(unsigned long size, unsigned nr)\n    -+static void stream_blob(size_t size, unsigned nr)\n    - {\n    - \tgit_zstream zstream = { 0 };\n    - \tstruct zlib_stream in_stream = {\n    -@@ builtin/unpack-objects.c: static void stream_blob(unsigned long size, unsigned nr)\n    +@@ builtin/unpack-objects.c: static void stream_blob(size_t size, unsigned nr)\n      }\n      \n      static int resolve_against_held(unsigned nr, const struct object_id *base,\n2:  438f7c6ba2 = 2:  9952f0fb10 index-pack: use size_t in write_compressed()\n3:  0258282745 ! 3:  e66860d274 index-pack: use size_t for object sizes\n    @@ Commit message\n         Functions like sha1_object() and append_obj_to_pack() in\n         builtin/index-pack.c take object sizes as an \"unsigned long\", even\n         though struct object_entry already tracks them as size_t. On platforms\n    -    where \"long\" is 32 bits, this truncates the size for objects of 4GiB or\n    -    more.\n    +    where \"long\" is 32 bits while size_t is 64, such as 64-bit Windows,\n    +    this truncates the size of objects of 4GiB or more.\n     \n         When receiving, on those platforms, a large object that already exists\n         locally, sha1_object() compares the real size (size_t) against the\n    @@ Commit message\n         Use size_t for the size parameter across these functions.\n     \n         Triggering this requires processing 4GiB or more of input on a platform\n    -    where \"long\" is 32 bits, so no test is added.\n    +    where \"long\" is 32 bits while size_t is 64, so no test is added.\n     \n         Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>\n     \n4:  87b0d2bd96 ! 4:  00939c7f1b pack-check: use size_t for the size passed to verify callbacks\n    @@ Commit message\n         replicated in struct odb_fsck_options (odb.h) and implemented by\n         fsck_obj_buffer() in builtin/fsck.c.\n     \n    -    On platforms where \"long\" is 32 bits, running \"git fsck\" on packs with\n    -    objects of 4GiB or more passes a truncated size to fsck_obj_buffer(),\n    -    causing parse_object_buffer() and fsck_object() to inspect only a\n    -    prefix.\n    +    On platforms where \"long\" is 32 bits while size_t is 64, such as\n    +    64-bit Windows, running \"git fsck\" on packs with objects of 4GiB or\n    +    more passes a truncated size to fsck_obj_buffer(), causing\n    +    parse_object_buffer() and fsck_object() to inspect only a prefix.\n     \n         Use size_t for the size parameter in verify_fn,\n         struct odb_fsck_options.object_cb, and fsck_obj_buffer().\n    +    parse_object_buffer() and fsck_object() themselves still take an\n    +    \"unsigned long\"; until they are updated separately, they keep\n    +    inspecting only a prefix.\n     \n         Triggering this requires processing objects of 4GiB or more on a\n    -    platform where \"long\" is 32 bits, so no test is added.\n    +    platform where \"long\" is 32 bits while size_t is 64, so no test is\n    +    added.\n     \n         Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>\n     \n\nbase-commit: e1ec09b23c8e0deb21a0b95ac5996422277395d4\n-- \n2.53.0\n\n\n"},{"id":"558674","messageId":"b2c3d349a4ac73da7e1d066ac43754d3e6939b9f.1794984184.git.gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"cover.1794984184.git.gitter.spiros@gmail.com","subject":"[PATCH v2 1/4] unpack-objects: use size_t for object sizes","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-11-18T06:56:35Z","receivedAt":"2026-11-18T06:56:35Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"Since f2063855fb (index-pack, unpack-objects: use size_t for object\nsize, 2026-05-08), unpack_one() decodes the size of an object into a\nsize_t, and e07ac16d1c (unpack-objects: pass the size of a streamed\nblob as size_t, 2026-11-06) passes it on as such to stream_blob(),\nwhich handles blobs larger than core.bigFileThreshold. The rest of\nbuiltin/unpack-objects.c still takes the size as an \"unsigned long\":\n\n - unpack_non_delta_entry() and get_data(), used for commits, trees,\n   tags and blobs below core.bigFileThreshold, and for all blobs with\n   \"git unpack-objects -n\", which never streams;\n\n - unpack_delta_entry() and the functions that keep and resolve\n   deltas;\n\n - struct obj_buffer, which keeps objects around for --strict.\n\nOn platforms where \"long\" is 32 bits while size_t is 64, such as 64-bit\nWindows, the size of an object of 4GiB or more is therefore truncated:\n\n - For an object that is not streamed, get_data() allocates a buffer\n   of the truncated size, inflate runs out of room in it, and\n   unpack-objects fails with \"inflate returned -5\". Truncating the\n   size to 16 bits in get_data() and unpack_non_delta_entry()\n   reproduces this with a pack holding a 70000-byte blob, both with\n   and without -n.\n\n - unpack_delta_entry() reads the base of a delta through\n   cast_size_t_to_ulong(), so a base of 4GiB or more makes it die even\n   when the result would be smaller.\n\n - The result of a delta reaches write_object() as a size_t, but\n   write_object() takes it as an \"unsigned long\". A result of 4GiB or\n   more is silently truncated there, and an object with the wrong\n   contents, hence the wrong name, is written.\n\nUse size_t across builtin/unpack-objects.c. The functions that\nwrite_object() hands objects to, odb_write_object() and\nparse_object_buffer(), still take an \"unsigned long\", as does\nfsck_object(); they are updated separately. Until then, move the size\ncast from unpack_delta_entry() to write_object(), where the size is\npassed to them. fsck_object() only sees objects that went through\nparse_object_buffer() first, and so does write_cached_object(), which\nwrites them out later; neither needs a cast of its own.\n\nAs a result, on those platforms:\n\n - \"git unpack-objects -n\" handles objects of any size;\n\n - a delta with a base of 4GiB or more and a smaller result is\n   resolved;\n\n - an object of 4GiB or more that is not streamed and has to be\n   written, including the result of a delta, makes unpack-objects die\n   with \"object too large to read on this platform\" instead of failing\n   with \"inflate returned -5\" or being written truncated.\n\nTruncating the size to 16 bits where write_object() passes it on\nconfirms the last point for a 70000-byte blob: with the cast,\nunpack-objects dies with \"object too large to read on this platform:\n70000 is cut off to 4464\"; without it, it exits with 0 and writes a\ntruncated blob under another name.\n\nTriggering this requires processing an object of 4GiB or more on a\nplatform where \"long\" is 32 bits while size_t is 64, so no test is\nadded.\n\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n builtin/unpack-objects.c | 42 ++++++++++++++++++++--------------------\n 1 file changed, 21 insertions(+), 21 deletions(-)\n\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex d2f25bed49..9bd355b2c4 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -40,7 +40,7 @@ static struct progress *progress;\n  */\n struct obj_buffer {\n \tchar *buffer;\n-\tunsigned long size;\n+\tsize_t size;\n };\n \n static struct decoration obj_decorate;\n@@ -50,7 +50,7 @@ static struct obj_buffer *lookup_object_buffer(struct object *base)\n \treturn lookup_decoration(&obj_decorate, base);\n }\n \n-static void add_object_buffer(struct object *object, char *buffer, unsigned long size)\n+static void add_object_buffer(struct object *object, char *buffer, size_t size)\n {\n \tstruct obj_buffer *obj;\n \tCALLOC_ARRAY(obj, 1);\n@@ -114,10 +114,10 @@ static void use(int bytes)\n  * allocated buffer which is reused to hold temporary zstream output\n  * and return NULL instead of returning garbage data.\n  */\n-static void *get_data(unsigned long size)\n+static void *get_data(size_t size)\n {\n \tgit_zstream stream;\n-\tunsigned long bufsize = dry_run && size > 8192 ? 8192 : size;\n+\tsize_t bufsize = dry_run && size > 8192 ? 8192 : size;\n \tvoid *buf = xmallocz(bufsize);\n \n \tmemset(&stream, 0, sizeof(stream));\n@@ -161,7 +161,7 @@ struct delta_info {\n \tstruct object_id base_oid;\n \tunsigned nr;\n \toff_t base_offset;\n-\tunsigned long size;\n+\tsize_t size;\n \tvoid *delta;\n \tstruct delta_info *next;\n };\n@@ -170,7 +170,7 @@ static struct delta_info *delta_list;\n \n static void add_delta_to_list(unsigned nr, const struct object_id *base_oid,\n \t\t\t      off_t base_offset,\n-\t\t\t      void *delta, unsigned long size)\n+\t\t\t      void *delta, size_t size)\n {\n \tstruct delta_info *info = xmalloc(sizeof(*info));\n \n@@ -261,7 +261,7 @@ static void write_rest(void)\n }\n \n static void added_object(unsigned nr, enum object_type type,\n-\t\t\t void *data, unsigned long size);\n+\t\t\t void *data, size_t size);\n \n /*\n  * Write out nr-th object from the list, now we know the contents\n@@ -269,10 +269,11 @@ static void added_object(unsigned nr, enum object_type type,\n  * to be checked at the end.\n  */\n static void write_object(unsigned nr, enum object_type type,\n-\t\t\t void *buf, unsigned long size)\n+\t\t\t void *buf, size_t size)\n {\n \tif (!strict) {\n-\t\tif (odb_write_object(the_repository->objects, buf, size, type,\n+\t\tif (odb_write_object(the_repository->objects, buf,\n+\t\t\t\t     cast_size_t_to_ulong(size), type,\n \t\t\t\t     &obj_list[nr].oid) < 0)\n \t\t\tdie(\"failed to write object\");\n \t\tadded_object(nr, type, buf, size);\n@@ -280,7 +281,8 @@ static void write_object(unsigned nr, enum object_type type,\n \t\tobj_list[nr].obj = NULL;\n \t} else if (type == OBJ_BLOB) {\n \t\tstruct blob *blob;\n-\t\tif (odb_write_object(the_repository->objects, buf, size, type,\n+\t\tif (odb_write_object(the_repository->objects, buf,\n+\t\t\t\t     cast_size_t_to_ulong(size), type,\n \t\t\t\t     &obj_list[nr].oid) < 0)\n \t\t\tdie(\"failed to write object\");\n \t\tadded_object(nr, type, buf, size);\n@@ -299,7 +301,7 @@ static void write_object(unsigned nr, enum object_type type,\n \t\t\t\t &obj_list[nr].oid);\n \t\tadded_object(nr, type, buf, size);\n \t\tobj = parse_object_buffer(the_repository, &obj_list[nr].oid,\n-\t\t\t\t\t  type, size, buf,\n+\t\t\t\t\t  type, cast_size_t_to_ulong(size), buf,\n \t\t\t\t\t  &eaten);\n \t\tif (!obj)\n \t\t\tdie(\"invalid %s\", type_name(type));\n@@ -310,8 +312,8 @@ static void write_object(unsigned nr, enum object_type type,\n }\n \n static void resolve_delta(unsigned nr, enum object_type type,\n-\t\t\t  void *base, unsigned long base_size,\n-\t\t\t  void *delta, unsigned long delta_size)\n+\t\t\t  void *base, size_t base_size,\n+\t\t\t  void *delta, size_t delta_size)\n {\n \tvoid *result;\n \tsize_t result_size;\n@@ -330,7 +332,7 @@ static void resolve_delta(unsigned nr, enum object_type type,\n  * resolve all the deltified objects that are based on it.\n  */\n static void added_object(unsigned nr, enum object_type type,\n-\t\t\t void *data, unsigned long size)\n+\t\t\t void *data, size_t size)\n {\n \tstruct delta_info **p = &delta_list;\n \tstruct delta_info *info;\n@@ -349,7 +351,7 @@ static void added_object(unsigned nr, enum object_type type,\n \t}\n }\n \n-static void unpack_non_delta_entry(enum object_type type, unsigned long size,\n+static void unpack_non_delta_entry(enum object_type type, size_t size,\n \t\t\t\t   unsigned nr)\n {\n \tvoid *buf = get_data(size);\n@@ -420,7 +422,7 @@ static void stream_blob(size_t size, unsigned nr)\n }\n \n static int resolve_against_held(unsigned nr, const struct object_id *base,\n-\t\t\t\tvoid *delta_data, unsigned long delta_size)\n+\t\t\t\tvoid *delta_data, size_t delta_size)\n {\n \tstruct object *obj;\n \tstruct obj_buffer *obj_buffer;\n@@ -435,12 +437,11 @@ static int resolve_against_held(unsigned nr, const struct object_id *base,\n \treturn 1;\n }\n \n-static void unpack_delta_entry(enum object_type type, unsigned long delta_size,\n+static void unpack_delta_entry(enum object_type type, size_t delta_size,\n \t\t\t       unsigned nr)\n {\n \tvoid *delta_data, *base;\n-\tunsigned long base_size;\n-\tsize_t base_size_st = 0;\n+\tsize_t base_size = 0;\n \tstruct object_id base_oid;\n \n \tif (type == OBJ_REF_DELTA) {\n@@ -517,8 +518,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,\n \t\treturn;\n \n \tbase = odb_read_object(the_repository->objects, &base_oid,\n-\t\t\t       &type, &base_size_st);\n-\tbase_size = cast_size_t_to_ulong(base_size_st);\n+\t\t\t       &type, &base_size);\n \tif (!base) {\n \t\terror(\"failed to read delta-pack base object %s\",\n \t\t      oid_to_hex(&base_oid));\n-- \n2.53.0\n\n\n"},{"id":"558675","messageId":"9952f0fb104450461661b3f8b5f646760198744c.1794984184.git.gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"cover.1794984184.git.gitter.spiros@gmail.com","subject":"[PATCH v2 2/4] index-pack: use size_t in write_compressed()","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-11-18T06:56:36Z","receivedAt":"2026-11-18T06:56:36Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"write_compressed() in builtin/index-pack.c takes the object size as an\n\"unsigned int\" and returns an \"int\", which are 32 bits wide on all\nplatforms. It is used by append_obj_to_pack() when resolving thin packs\nwith --fix-thin.\n\nWith a local base of 4GiB or more, write_compressed() compresses only\nthe first \"size mod 2^32\" bytes, while the pack header written by\nappend_obj_to_pack() records the full size. Later, when resolving deltas\nagainst that base, unpack_data() encounters an early end of stream and\ndies with \"serious inflate inconsistency\". Shrinking the parameter to 16\nbits and using a 100KiB base makes \"git index-pack --fix-thin\" die the\nsame way.\n\nUse size_t for both the size parameter and the return value.\n\nTriggering this requires processing a local base of 4GiB or more, so\nno test is added.\n\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n builtin/index-pack.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 0264c18c5f..f65228468b 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -1411,7 +1411,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha\n \t\t    nr_ofs_deltas + nr_ref_deltas - nr_resolved_deltas);\n }\n \n-static int write_compressed(struct hashfile *f, void *in, unsigned int size)\n+static size_t write_compressed(struct hashfile *f, void *in, size_t size)\n {\n \tgit_zstream stream;\n \tint status;\n-- \n2.53.0\n\n\n"},{"id":"558676","messageId":"e66860d27488d61e942dc5dc3fa2c7bffb50b2ca.1794984184.git.gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"cover.1794984184.git.gitter.spiros@gmail.com","subject":"[PATCH v2 3/4] index-pack: use size_t for object sizes","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-11-18T06:56:37Z","receivedAt":"2026-11-18T06:56:37Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"Functions like sha1_object() and append_obj_to_pack() in\nbuiltin/index-pack.c take object sizes as an \"unsigned long\", even\nthough struct object_entry already tracks them as size_t. On platforms\nwhere \"long\" is 32 bits while size_t is 64, such as 64-bit Windows,\nthis truncates the size of objects of 4GiB or more.\n\nWhen receiving, on those platforms, a large object that already exists\nlocally, sha1_object() compares the real size (size_t) against the\ntruncated size, resulting in a false \"SHA1 COLLISION FOUND\" error and\naborting index-pack.\n\nUse size_t for the size parameter across these functions.\n\nTriggering this requires processing 4GiB or more of input on a platform\nwhere \"long\" is 32 bits while size_t is 64, so no test is added.\n\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n builtin/index-pack.c | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex f65228468b..d4c073654d 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -588,7 +588,7 @@ static void *unpack_raw_entry(struct object_entry *obj,\n }\n \n static void *unpack_data(struct object_entry *obj,\n-\t\t\t int (*consume)(const unsigned char *, unsigned long, void *),\n+\t\t\t int (*consume)(const unsigned char *, size_t, void *),\n \t\t\t void *cb_data)\n {\n \toff_t from = obj[0].idx.offset + obj[0].hdr_size;\n@@ -765,10 +765,10 @@ struct compare_data {\n \tstruct object_entry *entry;\n \tstruct odb_stream *st;\n \tunsigned char *buf;\n-\tunsigned long buf_size;\n+\tsize_t buf_size;\n };\n \n-static int compare_objects(const unsigned char *buf, unsigned long size,\n+static int compare_objects(const unsigned char *buf, size_t size,\n \t\t\t   void *cb_data)\n {\n \tstruct compare_data *data = cb_data;\n@@ -881,7 +881,7 @@ static void do_record_outgoing_links(struct object *obj)\n }\n \n static void sha1_object(const void *data, struct object_entry *obj_entry,\n-\t\t\tunsigned long size, enum object_type type,\n+\t\t\tsize_t size, enum object_type type,\n \t\t\tconst struct object_id *oid)\n {\n \tvoid *new_data = NULL;\n@@ -1438,11 +1438,11 @@ static size_t write_compressed(struct hashfile *f, void *in, size_t size)\n \n static struct object_entry *append_obj_to_pack(struct hashfile *f,\n \t\t\t       const unsigned char *sha1, void *buf,\n-\t\t\t       unsigned long size, enum object_type type)\n+\t\t\t       size_t size, enum object_type type)\n {\n \tstruct object_entry *obj = &objects[nr_objects++];\n \tunsigned char header[10];\n-\tunsigned long s = size;\n+\tsize_t s = size;\n \tint n = 0;\n \tunsigned char c = (type << 4) | (s & 15);\n \ts >>= 4;\n-- \n2.53.0\n\n\n"},{"id":"558677","messageId":"00939c7f1b144fb9dbbc1745e60f7baa18217742.1794984184.git.gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"cover.1794984184.git.gitter.spiros@gmail.com","subject":"[PATCH v2 4/4] pack-check: use size_t for the size passed to verify callbacks","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-11-18T06:56:38Z","receivedAt":"2026-11-18T06:56:38Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"verify_pack() in pack-check.c passes each object to a verify_fn callback\n(defined in pack.h) taking the object size as an \"unsigned long\", even\nthough pack-check already handles it as a size_t. This signature is also\nreplicated in struct odb_fsck_options (odb.h) and implemented by\nfsck_obj_buffer() in builtin/fsck.c.\n\nOn platforms where \"long\" is 32 bits while size_t is 64, such as\n64-bit Windows, running \"git fsck\" on packs with objects of 4GiB or\nmore passes a truncated size to fsck_obj_buffer(), causing\nparse_object_buffer() and fsck_object() to inspect only a prefix.\n\nUse size_t for the size parameter in verify_fn,\nstruct odb_fsck_options.object_cb, and fsck_obj_buffer().\nparse_object_buffer() and fsck_object() themselves still take an\n\"unsigned long\"; until they are updated separately, they keep\ninspecting only a prefix.\n\nTriggering this requires processing objects of 4GiB or more on a\nplatform where \"long\" is 32 bits while size_t is 64, so no test is\nadded.\n\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n builtin/fsck.c | 2 +-\n odb.h          | 2 +-\n pack.h         | 2 +-\n 3 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex c4558efcf1..5849194686 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -392,7 +392,7 @@ static void check_connectivity(struct repository *repo)\n }\n \n static int fsck_obj_buffer(const struct object_id *oid, enum object_type type,\n-\t\t\t   unsigned long size, void *buffer, int *eaten, void *cb_data)\n+\t\t\t   size_t size, void *buffer, int *eaten, void *cb_data)\n {\n \tstruct repository *repo = cb_data;\n \tstruct object *obj;\ndiff --git a/odb.h b/odb.h\nindex 857637f980..9d4ef41d9b 100644\n--- a/odb.h\n+++ b/odb.h\n@@ -210,7 +210,7 @@ struct odb_fsck_options {\n \tenum odb_fsck_flags flags;\n \n \tint (*object_cb)(const struct object_id *oid, enum object_type type,\n-\t\t\t unsigned long size, void *buffer, int *eaten, void *cb_data);\n+\t\t\t size_t size, void *buffer, int *eaten, void *cb_data);\n \tvoid *object_payload;\n };\n \ndiff --git a/pack.h b/pack.h\nindex 2f2ce97c11..acc72a9527 100644\n--- a/pack.h\n+++ b/pack.h\n@@ -88,7 +88,7 @@ struct progress;\n /* Note, the data argument could be NULL if object type is blob */\n typedef int (*verify_fn)(const struct object_id *oid,\n \t\t\t enum object_type type,\n-\t\t\t unsigned long size,\n+\t\t\t size_t size,\n \t\t\t void *buffer, int *eaten,\n \t\t\t void *fn_data);\n \n-- \n2.53.0\n\n\n"},{"id":"558706","messageId":"av2pBh7vLj5DVDha@pks.im","threadId":"66728","inReplyTo":"b2c3d349a4ac73da7e1d066ac43754d3e6939b9f.1794984184.git.gitter.spiros@gmail.com","subject":"Re: [PATCH v2 1/4] unpack-objects: use size_t for object sizes","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-11-18T13:33:12Z","receivedAt":"2026-11-18T13:33:12Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Nov 18, 2026 at 07:56:35AM +0100, Elia Pinto wrote:\n> Since f2063855fb (index-pack, unpack-objects: use size_t for object\n> size, 2026-05-08), unpack_one() decodes the size of an object into a\n> size_t, and e07ac16d1c (unpack-objects: pass the size of a streamed\n> blob as size_t, 2026-11-06) passes it on as such to stream_blob(),\n> which handles blobs larger than core.bigFileThreshold. The rest of\n> builtin/unpack-objects.c still takes the size as an \"unsigned long\":\n> \n>  - unpack_non_delta_entry() and get_data(), used for commits, trees,\n>    tags and blobs below core.bigFileThreshold, and for all blobs with\n>    \"git unpack-objects -n\", which never streams;\n> \n>  - unpack_delta_entry() and the functions that keep and resolve\n>    deltas;\n> \n>  - struct obj_buffer, which keeps objects around for --strict.\n> \n> On platforms where \"long\" is 32 bits while size_t is 64, such as 64-bit\n> Windows, the size of an object of 4GiB or more is therefore truncated:\n> \n>  - For an object that is not streamed, get_data() allocates a buffer\n>    of the truncated size, inflate runs out of room in it, and\n>    unpack-objects fails with \"inflate returned -5\". Truncating the\n>    size to 16 bits in get_data() and unpack_non_delta_entry()\n>    reproduces this with a pack holding a 70000-byte blob, both with\n>    and without -n.\n> \n>  - unpack_delta_entry() reads the base of a delta through\n>    cast_size_t_to_ulong(), so a base of 4GiB or more makes it die even\n>    when the result would be smaller.\n> \n>  - The result of a delta reaches write_object() as a size_t, but\n>    write_object() takes it as an \"unsigned long\". A result of 4GiB or\n>    more is silently truncated there, and an object with the wrong\n>    contents, hence the wrong name, is written.\n> \n> Use size_t across builtin/unpack-objects.c. The functions that\n> write_object() hands objects to, odb_write_object() and\n> parse_object_buffer(), still take an \"unsigned long\", as does\n> fsck_object(); they are updated separately. Until then, move the size\n> cast from unpack_delta_entry() to write_object(), where the size is\n> passed to them. fsck_object() only sees objects that went through\n> parse_object_buffer() first, and so does write_cached_object(), which\n> writes them out later; neither needs a cast of its own.\n> \n> As a result, on those platforms:\n> \n>  - \"git unpack-objects -n\" handles objects of any size;\n> \n>  - a delta with a base of 4GiB or more and a smaller result is\n>    resolved;\n> \n>  - an object of 4GiB or more that is not streamed and has to be\n>    written, including the result of a delta, makes unpack-objects die\n>    with \"object too large to read on this platform\" instead of failing\n>    with \"inflate returned -5\" or being written truncated.\n> \n> Truncating the size to 16 bits where write_object() passes it on\n> confirms the last point for a 70000-byte blob: with the cast,\n> unpack-objects dies with \"object too large to read on this platform:\n> 70000 is cut off to 4464\"; without it, it exits with 0 and writes a\n> truncated blob under another name.\n> \n> Triggering this requires processing an object of 4GiB or more on a\n> platform where \"long\" is 32 bits while size_t is 64, so no test is\n> added.\n\nPhew, this commit message really is extremely verbose, and I eventually\nlost steam reading through it halfways. It's good to document what\nyou're doing, but this here might have gone off the rails a bit with\nthat.\n\nWhat's worth documenting is the unexpected parts in your patch, and\nthings that may not be immediately obvious to a reviewer. But you also\ndocument what specifically you are doing to what function, and that's\nquite obvious from the diff itself. So overall I bet that this message\ncould be condensed to half or even a third of its size without losing\nmuch information.\n\n> diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\n> index d2f25bed49..9bd355b2c4 100644\n> --- a/builtin/unpack-objects.c\n> +++ b/builtin/unpack-objects.c\n> @@ -269,10 +269,11 @@ static void added_object(unsigned nr, enum object_type type,\n>   * to be checked at the end.\n>   */\n>  static void write_object(unsigned nr, enum object_type type,\n> -\t\t\t void *buf, unsigned long size)\n> +\t\t\t void *buf, size_t size)\n>  {\n>  \tif (!strict) {\n> -\t\tif (odb_write_object(the_repository->objects, buf, size, type,\n> +\t\tif (odb_write_object(the_repository->objects, buf,\n> +\t\t\t\t     cast_size_t_to_ulong(size), type,\n>  \t\t\t\t     &obj_list[nr].oid) < 0)\n>  \t\t\tdie(\"failed to write object\");\n>  \t\tadded_object(nr, type, buf, size);\n\nThese casts here make me a bit unhappy, as you also have a patch series\nin flight that fix `odb_write_object()`. So you'll have to send another\npatch series after both have landed to remove those again.\n\nWould it make more sense to defer this series here until the other one\nlands?\n\n> @@ -299,7 +301,7 @@ static void write_object(unsigned nr, enum object_type type,\n>  \t\t\t\t &obj_list[nr].oid);\n>  \t\tadded_object(nr, type, buf, size);\n>  \t\tobj = parse_object_buffer(the_repository, &obj_list[nr].oid,\n> -\t\t\t\t\t  type, size, buf,\n> +\t\t\t\t\t  type, cast_size_t_to_ulong(size), buf,\n>  \t\t\t\t\t  &eaten);\n>  \t\tif (!obj)\n>  \t\t\tdie(\"invalid %s\", type_name(type));\n\nLikewise, even though I don't know whether you also have a patch series\nin flight fixing this one from the top of my head.\n\nPatrick\n\n"},{"id":"558707","messageId":"av2pOWbYxNDYvS9p@pks.im","threadId":"66728","inReplyTo":"9952f0fb104450461661b3f8b5f646760198744c.1794984184.git.gitter.spiros@gmail.com","subject":"Re: [PATCH v2 2/4] index-pack: use size_t in write_compressed()","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-11-18T13:33:45Z","receivedAt":"2026-11-18T13:33:45Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Nov 18, 2026 at 07:56:36AM +0100, Elia Pinto wrote:\n> write_compressed() in builtin/index-pack.c takes the object size as an\n> \"unsigned int\" and returns an \"int\", which are 32 bits wide on all\n> platforms. It is used by append_obj_to_pack() when resolving thin packs\n> with --fix-thin.\n> \n> With a local base of 4GiB or more, write_compressed() compresses only\n> the first \"size mod 2^32\" bytes, while the pack header written by\n> append_obj_to_pack() records the full size. Later, when resolving deltas\n> against that base, unpack_data() encounters an early end of stream and\n> dies with \"serious inflate inconsistency\". Shrinking the parameter to 16\n> bits and using a 100KiB base makes \"git index-pack --fix-thin\" die the\n> same way.\n> \n> Use size_t for both the size parameter and the return value.\n\nHmm. It's probably an improvement, but the only caller does this:\n\n\tobj[1].idx.offset += write_compressed(f, buf, size);\n\nThat's a `struct pack_idx_entry`, but its `offset` field is of type\n`off_t`, which is signed. It feels sufficiently unlikely to ever\noverflow, but should we verify regardless that we don't?\n\n> Triggering this requires processing a local base of 4GiB or more, so\n> no test is added.\n\nNot even an EXPENSIVE one?\n\nPatrick\n\n"},{"id":"558708","messageId":"av2pUyAwTA7e2eOj@pks.im","threadId":"66728","inReplyTo":"00939c7f1b144fb9dbbc1745e60f7baa18217742.1794984184.git.gitter.spiros@gmail.com","subject":"Re: [PATCH v2 4/4] pack-check: use size_t for the size passed to verify callbacks","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-11-18T13:34:11Z","receivedAt":"2026-11-18T13:34:11Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Nov 18, 2026 at 07:56:38AM +0100, Elia Pinto wrote:\n> verify_pack() in pack-check.c passes each object to a verify_fn callback\n> (defined in pack.h) taking the object size as an \"unsigned long\", even\n> though pack-check already handles it as a size_t. This signature is also\n> replicated in struct odb_fsck_options (odb.h) and implemented by\n> fsck_obj_buffer() in builtin/fsck.c.\n> \n> On platforms where \"long\" is 32 bits while size_t is 64, such as\n> 64-bit Windows, running \"git fsck\" on packs with objects of 4GiB or\n> more passes a truncated size to fsck_obj_buffer(), causing\n> parse_object_buffer() and fsck_object() to inspect only a prefix.\n\nThe more interesting question to me is: if they only inspect a prefix,\ndo they actually notice that something is off and report the error? If\nnot that certainly sounds like a bug to me.\n\nPatrick\n\n"},{"id":"558725","messageId":"xmqqwlqa6poo.fsf@gitster.g","threadId":"66728","inReplyTo":"av2pBh7vLj5DVDha@pks.im","subject":"Re: [PATCH v2 1/4] unpack-objects: use size_t for object sizes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-11-18T16:59:35Z","receivedAt":"2026-11-18T16:59:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> What's worth documenting is the unexpected parts in your patch, and\n> things that may not be immediately obvious to a reviewer. But you also\n> document what specifically you are doing to what function, and that's\n> quite obvious from the diff itself. So overall I bet that this message\n> could be condensed to half or even a third of its size without losing\n> much information.\n\nGood observation and matches my impression on recent proposed log\nmessages I see on the list, not limited to this author but by\nothers.  Perhaps people should paste their text to their nearby\nfaviourite LLM and ask it to condense it down by 70% without losing\nsubstance, and notch it down if they feel the result lost too much,\nor something.\n\n"},{"id":"558788","messageId":"20261119060524.775205-1-gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"av2pBh7vLj5DVDha@pks.im","subject":"Re: [PATCH v2 1/4] unpack-objects: use size_t for object sizes","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-11-19T06:05:21Z","receivedAt":"2026-11-19T06:05:21Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"On Wed, Nov 18, 2026 at 02:33:12PM +0100, Patrick Steinhardt wrote:\n> Phew, this commit message really is extremely verbose, and I eventually\n> lost steam reading through it halfways.\n[...]\n> So overall I bet that this message\n> could be condensed to half or even a third of its size without losing\n> much information.\n\nFair enough. I will cut it down to what the diff does not show: why\nthe cast moves to write_object() and what changes for the user.\n\n> These casts here make me a bit unhappy, as you also have a patch series\n> in flight that fix `odb_write_object()`. So you'll have to send another\n> patch series after both have landed to remove those again.\n>\n> Would it make more sense to defer this series here until the other one\n> lands?\n\nYes. odb_write_object() is changed by \"use size_t for a few more\nobject and buffer sizes\" [1], and parse_object_buffer() and\nfsck_object() by \"use size_t when parsing and checking objects\" [2].\nOnce both are in, write_object() can pass the size on without a cast.\n\n4/4 depends on [2] as well (see my reply there), so I will hold back\n1/4 and 4/4 and resend them on top of [1] and [2]. 2/4 and 3/4 depend\non neither: 2/4 fixes a bug on all platforms, 3/4 a false \"SHA1\nCOLLISION FOUND\". Unless you or Junio prefer otherwise, I will send\nthose two on their own as v3, with your comments on 2/4 addressed.\n\n[1] https://lore.kernel.org/git/cover.1793439137.git.gitter.spiros@gmail.com/\n[2] https://lore.kernel.org/git/cover.1793444420.git.gitter.spiros@gmail.com/\n\nThanks,\nElia\n\n"},{"id":"558789","messageId":"20261119060524.775205-2-gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"av2pOWbYxNDYvS9p@pks.im","subject":"Re: [PATCH v2 2/4] index-pack: use size_t in write_compressed()","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-11-19T06:05:22Z","receivedAt":"2026-11-19T06:05:22Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"On Wed, Nov 18, 2026 at 02:33:45PM +0100, Patrick Steinhardt wrote:\n> Hmm. It's probably an improvement, but the only caller does this:\n>\n> \tobj[1].idx.offset += write_compressed(f, buf, size);\n>\n> That's a `struct pack_idx_entry`, but its `offset` field is of type\n> `off_t`, which is signed. It feels sufficiently unlikely to ever\n> overflow, but should we verify regardless that we don't?\n\nIt costs little, and index-pack already does so for the data it\nreads: use() dies with \"pack too large for current definition of\noff_t\" when signed_add_overflows(consumed_bytes, bytes). I will do the\nsame in append_obj_to_pack() in v3.\n\n> Not even an EXPENSIVE one?\n\nI can add one. It needs a local base of 4GiB and a thin pack with a\ndelta against it. Writing that small delta by hand keeps pack-objects\nout of the picture, so only index-pack has to hold the base in memory.\nAs it still takes a lot of memory and time, I would guard it with its\nown variable, like t5608 does with GIT_TEST_CLONE_2GB.\n\nThanks,\nElia\n\n"},{"id":"558790","messageId":"20261119060524.775205-3-gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"av2pUyAwTA7e2eOj@pks.im","subject":"Re: [PATCH v2 4/4] pack-check: use size_t for the size passed to verify callbacks","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-11-19T06:05:23Z","receivedAt":"2026-11-19T06:05:23Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"On Wed, Nov 18, 2026 at 02:34:11PM +0100, Patrick Steinhardt wrote:\n> The more interesting question to me is: if they only inspect a prefix,\n> do they actually notice that something is off and report the error? If\n> not that certainly sounds like a bug to me.\n\nLooking at it again, on master the callback is not even reached for\nsuch an object. Just before calling it, verify_packfile() checks the\nobject with check_object_signature(), which also takes an \"unsigned\nlong\". It hashes only the prefix, the hash does not match, and fsck\nreports \"packed <oid> from <pack> is corrupt\" for an object that is\nfine. So fsck does complain, but for the wrong reason, and the commit\nmessage is wrong to say that the callbacks look at a prefix today.\n\ncheck_object_signature() is changed by 1/4 of \"use size_t when parsing\nand checking objects\" [1]. Only then is the callback reached, and it\nneeds this patch to get the whole size, plus the rest of [1] for\nparse_object_buffer() and fsck_object(). So 4/4 belongs on top of [1],\nand I will resend it there with a corrected message.\n\nBlobs are not affected: on these platforms core.bigFileThreshold, an\n\"unsigned long\" itself, is below 4GiB, so every blob that large is\nchecked with stream_object_signature() and reaches the callback\nwithout its data.\n\n[1] https://lore.kernel.org/git/cover.1793444420.git.gitter.spiros@gmail.com/\n\nThanks,\nElia\n\n"},{"id":"558814","messageId":"av7K08K9MIQyxRTW@pks.im","threadId":"66728","inReplyTo":"xmqqwlqa6poo.fsf@gitster.g","subject":"Re: [PATCH v2 1/4] unpack-objects: use size_t for object sizes","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-11-19T10:09:23Z","receivedAt":"2026-11-19T10:09:23Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Nov 18, 2026 at 08:59:35AM -0800, Junio C Hamano wrote:\n> Patrick Steinhardt <ps@pks.im> writes:\n> \n> > What's worth documenting is the unexpected parts in your patch, and\n> > things that may not be immediately obvious to a reviewer. But you also\n> > document what specifically you are doing to what function, and that's\n> > quite obvious from the diff itself. So overall I bet that this message\n> > could be condensed to half or even a third of its size without losing\n> > much information.\n> \n> Good observation and matches my impression on recent proposed log\n> messages I see on the list, not limited to this author but by\n> others.  Perhaps people should paste their text to their nearby\n> faviourite LLM and ask it to condense it down by 70% without losing\n> substance, and notch it down if they feel the result lost too much,\n> or something.\n\nThat assumes that it's their text in the first place, and in many cases\nI'd say it's obvious that it is not. The offending texts really look too\nsimilar for this to be sheer coincidence. So we can probably avoid one\nroundtrip by telling the LLM to be concise in the first go already.\n\nPatrick\n\n"},{"id":"558815","messageId":"av7LcjLcTocYH8b-@pks.im","threadId":"66728","inReplyTo":"20261119060524.775205-1-gitter.spiros@gmail.com","subject":"Re: [PATCH v2 1/4] unpack-objects: use size_t for object sizes","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-11-19T10:12:02Z","receivedAt":"2026-11-19T10:12:02Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Thu, Nov 19, 2026 at 07:05:21AM +0100, Elia Pinto wrote:\n> On Wed, Nov 18, 2026 at 02:33:12PM +0100, Patrick Steinhardt wrote:\n> > Phew, this commit message really is extremely verbose, and I eventually\n> > lost steam reading through it halfways.\n> [...]\n> > So overall I bet that this message\n> > could be condensed to half or even a third of its size without losing\n> > much information.\n> \n> Fair enough. I will cut it down to what the diff does not show: why\n> the cast moves to write_object() and what changes for the user.\n> \n> > These casts here make me a bit unhappy, as you also have a patch series\n> > in flight that fix `odb_write_object()`. So you'll have to send another\n> > patch series after both have landed to remove those again.\n> >\n> > Would it make more sense to defer this series here until the other one\n> > lands?\n> \n> Yes. odb_write_object() is changed by \"use size_t for a few more\n> object and buffer sizes\" [1], and parse_object_buffer() and\n> fsck_object() by \"use size_t when parsing and checking objects\" [2].\n> Once both are in, write_object() can pass the size on without a cast.\n> \n> 4/4 depends on [2] as well (see my reply there), so I will hold back\n> 1/4 and 4/4 and resend them on top of [1] and [2]. 2/4 and 3/4 depend\n> on neither: 2/4 fixes a bug on all platforms, 3/4 a false \"SHA1\n> COLLISION FOUND\". Unless you or Junio prefer otherwise, I will send\n> those two on their own as v3, with your comments on 2/4 addressed.\n\nDo we maybe just want to hold off the whole series until the dependency\nlands? As you've seen, having a bunch of similar series out there does\nnot guarantee that all of them land faster, but rather has the effect\nthat some of them don't get any reviews at all.\n\nThat's not all that surprising, as reviewing these kinds of series is\na bit tedious. That doesn't mean the changes are not useful, it's rather\nthat we are short on reviewing capacity.\n\nPatrick\n\n"},{"id":"558870","messageId":"20261119174853.829455-1-gitter.spiros@gmail.com","threadId":"66728","inReplyTo":"av7LcjLcTocYH8b-@pks.im","subject":"Re: [PATCH v2 1/4] unpack-objects: use size_t for object sizes","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2026-11-19T17:48:53Z","receivedAt":"2026-11-19T17:48:53Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"On Thu, Nov 19, 2026 at 11:12:02AM +0100, Patrick Steinhardt wrote:\n> Do we maybe just want to hold off the whole series until the dependency\n> lands?\n\nOK, I'll resend the series when needed. Thanks,\nElia\n\n"}]}