# Elia Pinto's size_t series for object and buffer sizes nears merge; reviewer asks about extra tests

_The patches fix silent truncation of data above 4 GiB on platforms where long is 32 bits, and overlap with a series by Christian Couder._

Section: Patches. Edition of 2026-11-24. Written by an AI editor from the thread "[PATCH 0/3] use size_t for a few more object and buffer sizes" (33 messages): https://gitlist.dev/t/66617

Elia Pinto's series addresses places that still pass sizes through unsigned long. On 64-bit Windows long is 32 bits, so anything above 4 GiB is silently lost. It builds on Johannes Schindelin's work on objects larger than 4 GiB on Windows and Jeff King's size_t work in the diff and merge code.

One fix is in the object database write API, where odb_write_object() still takes the length as unsigned long. A file converted before storage, for example with core.autocrlf, which Git for Windows enables by default, could be written truncated with no error. The other patches cover counters and buffer sizes elsewhere, including the "alloc" member of struct diff_words_buffer.

Christian Couder reviewed the series and said it looks almost there. He suggested commit message wording, such as noting that on common 64-bit platforms size_t is 64 bits while unsigned and int are 32. On the diff_words patch, he said the message should not suggest that removing MAX_XDIFF_SIZE would be safe, since many other things would break first.

He proposed EXPENSIVE tests, including a 2^32-line eol-stats test and a staged file over 4 GB in t1051, but said he is unsure the project wants to accumulate many such tests. He also asked that tests clean up after themselves so repository state does not depend on GIT_TEST_LONG.

Couder noted one patch is very similar to one he wrote independently. The code changes match, Pinto's commit message is arguably better, and Pinto adds a test. A small series of his own depends on this one, so he suggested merging this after a few more rounds. Junio Hamano said it was good to see contributors helping each other move topics along.
