summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-06 18:31:07 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-06 18:31:07 +0100
commitc965744e09a24270bb26e3e008dc2ede76544c98 (patch)
tree0ea105e7346f6d195b5e01ca171d721abffcf180 /tests
parent92c27bbda9e809683537e5cc48adad0d5c390587 (diff)
Fix: livesync watermark used sizeof(ot_peer) which is a byte. Clamping on copy length now
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/test_livesync.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/integration/test_livesync.py b/tests/integration/test_livesync.py
index f4cb2db..e146d93 100644
--- a/tests/integration/test_livesync.py
+++ b/tests/integration/test_livesync.py
@@ -72,6 +72,19 @@ class LiveSyncIn(TrackerTestCase):
72 self.assertTrue(self.tracker.wait_until(lambda: self.counts(info_hash) == (1, 0)), 72 self.assertTrue(self.tracker.wait_until(lambda: self.counts(info_hash) == (1, 0)),
73 "scrape says %r" % (self.counts(info_hash),)) 73 "scrape says %r" % (self.counts(info_hash),))
74 74
75 def test_many_v6_announces_do_not_overflow_the_send_buffer(self):
76 """The outgoing peer buffer is filled by announces to a clustered
77 tracker. The flush watermark used sizeof(ot_peer) (== 1), so a v6
78 record could be appended past the 1480-byte buffer onto the adjacent
79 fill field, which then drove an oversized stack copy. Well past the
80 old overflow point (~37 v6 peers) the tracker must still be alive."""
81 last = None
82 for i in range(80):
83 last = self.tracker.announce(self.hash_for("flood-%d" % i),
84 ip="2001:db8::%x" % (i + 1), port=7000 + i, left=1)
85 self.assertIn(b"complete", last, "the tracker stopped answering mid-flood")
86 # tearDown's stop() surfaces any sanitizer complaint on the way out.
87
75 def test_one_packet_carries_several_torrents(self): 88 def test_one_packet_carries_several_torrents(self):
76 hashes = [self.hash_for("sync-many-%d" % i) for i in range(4)] 89 hashes = [self.hash_for("sync-many-%d" % i) for i in range(4)]
77 self.tracker.livesync_send(packet(SYNC_PEER4, [(h, peer4("10.1.2.%d" % (5 + i), 6881, FLAG_SEEDING)) 90 self.tracker.livesync_send(packet(SYNC_PEER4, [(h, peer4("10.1.2.%d" % (5 + i), 6881, FLAG_SEEDING))