Don't use iterator addresses in IteratorComparator

The addresses of the iterator values are non-deterministic (i.e. they
depend on where the values were allocated). This causes stability issues
when fuzzing (e.g. in the `txorphan` and `mini_miner` harnesses), due
the orders (derived from IteratorComparator) not being deterministic.

Improve stability by comparing the first element in the iterator value
pair instead of using the the value addresses.
This commit is contained in:
dergoegge
2024-06-19 09:57:22 +01:00
parent 41544b8f96
commit e009bf681c
2 changed files with 2 additions and 2 deletions

View File

@@ -63,7 +63,7 @@ struct IteratorComparator
template<typename I>
bool operator()(const I& a, const I& b) const
{
return &(*a) < &(*b);
return a->first < b->first;
}
};

View File

@@ -92,7 +92,7 @@ protected:
template<typename I>
bool operator()(const I& a, const I& b) const
{
return &(*a) < &(*b);
return a->first < b->first;
}
};