diff --git a/src/borg/testsuite/hashindex.py b/src/borg/testsuite/hashindex.py index fa0e3b83e..8a706ab46 100644 --- a/src/borg/testsuite/hashindex.py +++ b/src/borg/testsuite/hashindex.py @@ -510,3 +510,45 @@ class AllIndexTestCase(BaseTestCase): def test_max_load_factor(self): assert NSIndex.MAX_LOAD_FACTOR < 1.0 assert ChunkIndex.MAX_LOAD_FACTOR < 1.0 + + +class IndexCorruptionTestCase(BaseTestCase): + def test_bug_4829(self): + + from struct import pack + + def HH(x, y): + # make some 32byte long thing that depends on x and y. + # same x will mean a collision in the hashtable as bucket index is computed from + # first 4 bytes. giving a specific x targets bucket index x. + # y is to create different keys and does not go into the bucket index calculation. + # so, same x + different y --> collision + return pack('