mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user