From 876e2849b4ec9e1f4b89773c2faadcca77831b82 Mon Sep 17 00:00:00 2001 From: marcofleon Date: Fri, 12 Dec 2025 12:19:07 +0000 Subject: [PATCH] fuzz: Fix incorrect loop bounds in `clusterlin_postlinearize_tree` The dependency graphs generated by this test can have holes (unused indices) in them. This means some of the transactions were skipped when using `depgraph_gen.TxCount()` as the upper bound of the loop. Switch to using `depgraph.Positions()` to correctly handle sparse graphs. --- src/test/fuzz/cluster_linearize.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/fuzz/cluster_linearize.cpp b/src/test/fuzz/cluster_linearize.cpp index 61b95c71313..86734591d99 100644 --- a/src/test/fuzz/cluster_linearize.cpp +++ b/src/test/fuzz/cluster_linearize.cpp @@ -1275,14 +1275,14 @@ FUZZ_TARGET(clusterlin_postlinearize_tree) depgraph_tree.RemoveTransactions(TestBitSet::Fill(depgraph_gen.PositionRange()) - depgraph_gen.Positions()); if (direction & 1) { - for (DepGraphIndex i = 0; i < depgraph_gen.TxCount(); ++i) { + for (DepGraphIndex i : depgraph_gen.Positions()) { auto children = depgraph_gen.GetReducedChildren(i); if (children.Any()) { depgraph_tree.AddDependencies(TestBitSet::Singleton(i), children.First()); } } } else { - for (DepGraphIndex i = 0; i < depgraph_gen.TxCount(); ++i) { + for (DepGraphIndex i : depgraph_gen.Positions()) { auto parents = depgraph_gen.GetReducedParents(i); if (parents.Any()) { depgraph_tree.AddDependencies(TestBitSet::Singleton(parents.First()), i);