Skip to content

Commit d8ac9ee

Browse files
derrickstoleegitster
authored andcommitted
multi-pack-index: fix 32-bit vs 64-bit size check
When loading a 64-bit offset, we intend to check that off_t can store the resulting offset. However, the condition accidentally checks the 32-bit offset to see if it is smaller than a 64-bit value. Fix it, and this will be covered by a test in the 'git multi-pack-index verify' command in a later commit. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 55c5648 commit d8ac9ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

midx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static off_t nth_midxed_offset(struct multi_pack_index *m, uint32_t pos)
236236
offset32 = get_be32(offset_data + sizeof(uint32_t));
237237

238238
if (m->chunk_large_offsets && offset32 & MIDX_LARGE_OFFSET_NEEDED) {
239-
if (sizeof(offset32) < sizeof(uint64_t))
239+
if (sizeof(off_t) < sizeof(uint64_t))
240240
die(_("multi-pack-index stores a 64-bit offset, but off_t is too small"));
241241

242242
offset32 ^= MIDX_LARGE_OFFSET_NEEDED;

0 commit comments

Comments
 (0)