]> git.ipfire.org Git - thirdparty/git.git/commit - midx.c
midx.c: prevent overflow in `nth_midxed_offset()`
authorTaylor Blau <me@ttaylorr.com>
Wed, 12 Jul 2023 23:37:41 +0000 (19:37 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Jul 2023 16:32:03 +0000 (09:32 -0700)
commit5675150cc3bfc03c5721edcfc49fbe43b15b5209
tree6378623b78240ab5ee5c1f642eac67902ed4a528
parentc2b24ede229dbc6686e37c8cae1e169fc356049e
midx.c: prevent overflow in `nth_midxed_offset()`

In a similar spirit as previous patches, avoid an overflow when looking
up object offsets in the MIDX's large offset table by guarding the
computation via `st_mult()`.

This instance is also OK as-is, since the left operand is the result of
`sizeof(...)`, which is already a `size_t`. But use `st_mult()` instead
here to make it explicit that this computation is to be performed using
64-bit unsigned integers.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx.c