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

When writing a MIDX, we use the chunk-format API to write out each
individual chunk of the MIDX. Each chunk of the MIDX is tracked via a
call to `add_chunk()`, along with the expected size of that chunk.

Guard against overflow when dealing with a MIDX with a large number of
entries (and consequently, large chunks within the MIDX file itself) to
avoid corrupting the contents of the MIDX itself.

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