Commit d2451fed by Carlos Martín Nieto Committed by GitHub

Merge pull request #3984 from pks-t/pks/pack-find-offset-race

pack: fix race in pack_entry_find_offset
parents 19001ca7 0cf15e39
......@@ -1268,8 +1268,8 @@ static int pack_entry_find_offset(
const git_oid *short_oid,
size_t len)
{
const uint32_t *level1_ofs = p->index_map.data;
const unsigned char *index = p->index_map.data;
const uint32_t *level1_ofs;
const unsigned char *index;
unsigned hi, lo, stride;
int pos, found = 0;
git_off_t offset;
......@@ -1283,11 +1283,11 @@ static int pack_entry_find_offset(
if ((error = pack_index_open(p)) < 0)
return error;
assert(p->index_map.data);
index = p->index_map.data;
level1_ofs = p->index_map.data;
}
index = p->index_map.data;
level1_ofs = p->index_map.data;
if (p->index_version > 1) {
level1_ofs += 2;
index += 8;
......
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