)]}'
{
  "commit": "f795fee96a9b31a1a5543612c21e43bf87bf97bd",
  "tree": "1b731bef135e7822a149968baebfe69dfa61dc78",
  "parents": [
    "750f5de7dfe9a4062f95088212b063f189d50e91"
  ],
  "author": {
    "name": "Elia Pinto",
    "email": "gitter.spiros@gmail.com",
    "time": "Sun Nov 01 08:29:03 2026 +0100"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Tue Nov 03 14:11:55 2026 -0800"
  },
  "message": "pack-objects: use size_t for streamed large blobs\n\nIn builtin/pack-objects.c, write_no_reuse_object() handles blobs\nexceeding core.bigFileThreshold by writing them in a streaming path. It\ntakes the size from st-\u003esize (size_t) and assigns it to an \"unsigned\nlong\" variable, which is then written to the pack object header, and\nwrite_large_blob_data() adds up the compressed length in an \"unsigned\nlong\" as well.\n\nOn platforms where \"long\" is 32 bits but size_t is 64 bits, like 64-bit\nWindows, handling a blob of 4GiB or more truncates the size in the pack\nheader while the data decompresses to the full size, corrupting the\nobject. If the compressed data also exceeds 4GiB, the length\naccumulation overflows \"unsigned long\", misaligning the offsets of all\nsubsequent objects in the index.\n\nWhen running repack or gc on a loose large blob, the original loose copy\nis pruned, leaving only the corrupted packed copy and resulting in data\nloss. Truncating st-\u003esize to 16 bits, with a 100KiB loose blob reachable\nfrom a commit and \"git -c core.bigFileThreshold\u003d1k repack -a -d\", leaves\na corrupt packed object and no loose copy.\n\nSwitch the streamed path to use size_t for the object size, and off_t\nfor the length of the compressed data, which write_large_blob_data()\nadds up while it writes the stream piece by piece, and for\nwrite_no_reuse_object()\u0027s return value, like write_reuse_object()\nalready does. Other truncations in pack-objects are not reachable\nbecause core.bigFileThreshold is itself an \"unsigned long\".\n\nTriggering this requires processing an object of 4GiB or more on a\nplatform where \"long\" is 32 bits but size_t is 64 bits, so no test is\nadded.\n\nHelped-by: Simon Richter \u003cSimon.Richter@hogyros.de\u003e\nSigned-off-by: Elia Pinto \u003cgitter.spiros@gmail.com\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ca3a891dfbce3e23ff6be66ad4ca49ec4c6382b8",
      "old_mode": 33188,
      "old_path": "builtin/pack-objects.c",
      "new_id": "24203b5359ae899c0301c9ec51bd5e68c28f4511",
      "new_mode": 33188,
      "new_path": "builtin/pack-objects.c"
    }
  ]
}
