mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Correct handling of corner-cases involving custom iterators:
- Under some conditions, comparing `ReadViewFwdRange::iterators` for equality could derefence an empty `std::unique_ptr` which will result in a crash. - Misuse of the `equal` API could result in a `std::bad_cast` exception being thrown from when iterating transactions or SLEs from the `OpenView`, `RawStateTable` and `Ledger` classes.
This commit is contained in:
@@ -45,8 +45,9 @@ public:
|
||||
bool
|
||||
equal(base_type const& impl) const override
|
||||
{
|
||||
auto const& other = dynamic_cast<txs_iter_impl const&>(impl);
|
||||
return iter_ == other.iter_;
|
||||
if (auto const p = dynamic_cast<txs_iter_impl const*>(&impl))
|
||||
return iter_ == p->iter_;
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user