mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
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:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user