Skip to content

Commit 4f7b568

Browse files
authored
Merge pull request libgit2#6291 from libgit2/cmn/midx-no-hash
midx: do not verify the checksum on load
2 parents 4f0ee02 + a3f9617 commit 4f7b568

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/libgit2/midx.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ int git_midx_parse(
179179
uint32_t i;
180180
off64_t last_chunk_offset, chunk_offset, trailer_offset;
181181
size_t checksum_size;
182-
unsigned char checksum[GIT_HASH_SHA1_SIZE];
183182
int error;
184183
struct git_midx_chunk chunk_packfile_names = {0},
185184
chunk_oid_fanout = {0},
@@ -217,11 +216,6 @@ int git_midx_parse(
217216
return midx_error("wrong index size");
218217
memcpy(idx->checksum, data + trailer_offset, checksum_size);
219218

220-
if (git_hash_buf(checksum, data, (size_t)trailer_offset, GIT_HASH_ALGORITHM_SHA1) < 0)
221-
return midx_error("could not calculate signature");
222-
if (memcmp(checksum, idx->checksum, checksum_size) != 0)
223-
return midx_error("index signature mismatch");
224-
225219
chunk_hdr = data + sizeof(struct git_midx_header);
226220
last_chunk = NULL;
227221
for (i = 0; i < hdr->chunks; ++i, chunk_hdr += 12) {

0 commit comments

Comments
 (0)