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.
This commit is contained in:
marcofleon
2025-12-12 12:19:07 +00:00
parent 938d7aacab
commit 876e2849b4

View File

@@ -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);