Skip to content

Commit

Permalink
Merge pull request borgbackup#4968 from ThomasWaldmann/fix-hashindex-…
Browse files Browse the repository at this point in the history
…set-1.0

fix bug in hashindex_set on resize, fixes borgbackup#4829 (1.0-maint backport)
  • Loading branch information
ThomasWaldmann authored Mar 5, 2020
2 parents 2cfafc2 + 7bb90b6 commit 3876468
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions borg/_hashindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,16 @@ hashindex_set(HashIndex *index, const void *key, const void *value)
if(!hashindex_resize(index, index->num_buckets)) {
return 0;
}
/* we have just built a fresh hashtable and removed all tombstones,
* so we only have EMPTY or USED buckets, but no DELETED ones any more.
*/
idx = hashindex_index(index, key);
while(!BUCKET_IS_EMPTY(index, idx)) {
idx++;
if (idx >= index->num_buckets){
idx -= index->num_buckets;
}
}
}
}
ptr = BUCKET_ADDR(index, idx);
Expand Down

0 comments on commit 3876468

Please sign in to comment.