From cfbe53da5d9ef8dad1bb3276c0b33ec2ab6e974b Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 7 Nov 2026 13:30:17 +0100 Subject: Fix s24s stats to ensure no unallocated vector is dereferenced. Drive-by fix for the ip= scanner in the http parser --- tests/integration/test_stats.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/integration/test_stats.py b/tests/integration/test_stats.py index 088d8a1..c4ac95a 100644 --- a/tests/integration/test_stats.py +++ b/tests/integration/test_stats.py @@ -177,6 +177,15 @@ class StatsNetworks(TrackerTestCase): for line in lines: self.assertEqual(int(line.split(b":")[0]), 3, "three peers from the one network") + def test_the_report_survives_a_torrent_with_no_v4_peers(self): + # A torrent whose only peer is v6 has no v4 peer list once the lists + # are allocated on demand. The s24 report walks the v4 list of every + # torrent, so it has to skip the absent one rather than follow a null + # pointer. Needs WANT_IP_FROM_QUERY_STRING to force the family; without + # it the peer is loopback v4 and the walk is never asked to skip. + self.tracker.announce(self.hash_for("s24v6only"), ip="2001:db8::1", port=6001, left=0) + self.assertIn(b"Networks, limit /24:", self.tracker.stats("s24s")) + if __name__ == "__main__": unittest.main() -- cgit v1.3