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:
1 parent
938d7aacab
commit
876e2849b4
1 file changed
+2
-2
@@ -1275,14 +1275,14 @@ FUZZ_TARGET(clusterlin_postlinearize_tree)
|
|||||||
depgraph_tree.RemoveTransactions(TestBitSet::Fill(depgraph_gen.PositionRange()) - depgraph_gen.Positions());
|
depgraph_tree.RemoveTransactions(TestBitSet::Fill(depgraph_gen.PositionRange()) - depgraph_gen.Positions());
|
||||||
|
|
||||||
if (direction & 1) {
|
if (direction & 1) {
|
||||||
for (DepGraphIndex i = 0; i < depgraph_gen.TxCount(); ++i) {
|
for (DepGraphIndex i : depgraph_gen.Positions()) {
|
||||||
auto children = depgraph_gen.GetReducedChildren(i);
|
auto children = depgraph_gen.GetReducedChildren(i);
|
||||||
if (children.Any()) {
|
if (children.Any()) {
|
||||||
depgraph_tree.AddDependencies(TestBitSet::Singleton(i), children.First());
|
depgraph_tree.AddDependencies(TestBitSet::Singleton(i), children.First());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (DepGraphIndex i = 0; i < depgraph_gen.TxCount(); ++i) {
|
for (DepGraphIndex i : depgraph_gen.Positions()) {
|
||||||
auto parents = depgraph_gen.GetReducedParents(i);
|
auto parents = depgraph_gen.GetReducedParents(i);
|
||||||
if (parents.Any()) {
|
if (parents.Any()) {
|
||||||
depgraph_tree.AddDependencies(TestBitSet::Singleton(parents.First()), i);
|
depgraph_tree.AddDependencies(TestBitSet::Singleton(parents.First()), i);
|
||||||
|
|||||||
Reference in new issue
Block a user