]> git.ipfire.org Git - thirdparty/git.git/commit - t/t5319-multi-pack-index.sh
midx: check size of object offset chunk
authorJeff King <peff@peff.net>
Mon, 9 Oct 2023 21:05:27 +0000 (17:05 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Oct 2023 22:55:01 +0000 (15:55 -0700)
commit0924869b4e27ff9db63e2d85b892244e058fecc3
treef0e527cbee545a672e619a54595fa4bd56557adb
parentc9b9fefc13ccce7ed248488c982d1da38b0905c7
midx: check size of object offset chunk

The object offset chunk has one fixed-size entry for each object in the
midx. But since we don't check its size, we may access out-of-bounds
memory if we see a corrupt or malicious midx file.

Sine the entries are fixed-size, the total length can be known up-front,
and we can just check it while parsing the chunk (this is similar to
what we do when opening pack idx files, which contain a similar offset
table).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx.c
t/t5319-multi-pack-index.sh