Unverified Commit 15e42fb5 by Edward Thomson Committed by GitHub

Merge pull request #6585 from libgit2/cmn/midx-no-oid-verify

midx: do not try to look at every object in the index
parents 40ed228b c1aa0213
......@@ -114,8 +114,6 @@ static int midx_parse_oid_lookup(
const unsigned char *data,
struct git_midx_chunk *chunk_oid_lookup)
{
uint32_t i;
unsigned char *oid, *prev_oid, zero_oid[GIT_OID_MAX_SIZE] = {0};
size_t oid_size = git_oid_size(idx->oid_type);
if (chunk_oid_lookup->offset == 0)
......@@ -125,13 +123,7 @@ static int midx_parse_oid_lookup(
if (chunk_oid_lookup->length != idx->num_objects * oid_size)
return midx_error("OID Lookup chunk has wrong length");
idx->oid_lookup = oid = (unsigned char *)(data + chunk_oid_lookup->offset);
prev_oid = zero_oid;
for (i = 0; i < idx->num_objects; ++i, oid += oid_size) {
if (git_oid_raw_cmp(prev_oid, oid, oid_size) >= 0)
return midx_error("OID Lookup index is non-monotonic");
prev_oid = oid;
}
idx->oid_lookup = (unsigned char *)(data + chunk_oid_lookup->offset);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment