"Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > From: Derrick Stolee <dstolee@xxxxxxxxxxxxx> > > When calculating the sizes of certain chunks, we should use 64-bit > multiplication always. This allows us to properly predict the chunk > sizes without risk of overflow. That's quite an obvious fix, applicable even before this entire series. I think we saw quite similar bugfixes in different parts of the codebase recently. So far, everything looks good. > Signed-off-by: Derrick Stolee <dstolee@xxxxxxxxxxxxx> > --- > midx.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/midx.c b/midx.c > index 0548266bea..47f5f60fcd 100644 > --- a/midx.c > +++ b/midx.c > @@ -946,12 +946,12 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index * > chunks[2].write_fn = write_midx_oid_lookup; > > chunks[3].id = MIDX_CHUNKID_OBJECTOFFSETS; > - chunks[3].size = ctx.entries_nr * MIDX_CHUNK_OFFSET_WIDTH; > + chunks[3].size = (uint64_t)ctx.entries_nr * MIDX_CHUNK_OFFSET_WIDTH; > chunks[3].write_fn = write_midx_object_offsets; > > if (ctx.large_offsets_needed) { > chunks[4].id = MIDX_CHUNKID_LARGEOFFSETS; > - chunks[4].size = ctx.num_large_offsets * MIDX_CHUNK_LARGE_OFFSET_WIDTH; > + chunks[4].size = (uint64_t)ctx.num_large_offsets * MIDX_CHUNK_LARGE_OFFSET_WIDTH; > chunks[4].write_fn = write_midx_large_offsets; > }