From: Damien Robert Date: Fri, 28 Feb 2020 16:24:49 GMT Subject: [PATCH 1/1] midx.c: fix an integer overflow Message-ID: <20200228162450.1720795-1-damien.olivier.robert+git@gmail.com> When verifying a midx index with 0 objects, the m->num_objects - 1 overflows to 4294967295. Fix this. Signed-off-by: Damien Robert --- midx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/midx.c b/midx.c index 37ec28623a..6ffe013089 100644 --- a/midx.c +++ b/midx.c @@ -1127,7 +1127,7 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag if (flags & MIDX_PROGRESS) progress = start_sparse_progress(_("Verifying OID order in multi-pack-index"), m->num_objects - 1); - for (i = 0; i < m->num_objects - 1; i++) { + for (i = 0; i + 1 < m->num_objects; i++) { struct object_id oid1, oid2; nth_midxed_object_oid(&oid1, m, i); -- Patched on top of v2.25.1-379-gd22418c625 (git version 2.25.1)