From 97e58519bc946daabcadc531510497c3598961a1 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 6 Nov 2026 20:25:39 +0100 Subject: Fix an accesslist reload issue where an empty-but-present changeset after a reload could potentially walk a NULL array --- tests/integration/test_dynamic_accesslist.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/integration/test_dynamic_accesslist.py') diff --git a/tests/integration/test_dynamic_accesslist.py b/tests/integration/test_dynamic_accesslist.py index 7fa5fde..2072f5e 100644 --- a/tests/integration/test_dynamic_accesslist.py +++ b/tests/integration/test_dynamic_accesslist.py @@ -40,6 +40,24 @@ class DynamicAccesslist(TrackerTestCase): time.sleep(0.05) return False + def test_a_hash_added_after_a_reload_is_blocked(self): + """A reload leaves the add changeset an empty list rather than an + absent one. Adding against it walked a null array; the hash must be + blocked and the tracker must stay up.""" + OTHER = bytes(range(21, 41)) + self.feed("add.fifo", BLOCKED) + self.assertTrue(self.wait_for(BLOCKED, blocked=True), "the first hash was never blocked") + + # The reload empties the add changeset, which unblocks the first hash. + # Wait for that before adding the second, so it lands on the empty list + # the bug walked, not on the changeset before the reload has cleared it. + self.tracker.reload() + self.assertTrue(self.wait_for(BLOCKED, blocked=False), "the reload never emptied the changeset") + + self.feed("add.fifo", OTHER) + self.assertTrue(self.wait_for(OTHER, blocked=True), "the hash added after the reload was never blocked") + # tearDown's stop() surfaces any sanitizer complaint on the way out. + def test_a_hash_can_be_blocked_and_released_while_running(self): self.assertNotIn(b"failure reason", self.tracker.announce(BLOCKED)) -- cgit v1.3