Skip to content

Commit

Permalink
Guard iterator::is_match() against invalid member position.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Jun 10, 2024
1 parent 324907b commit 536f13c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions include/bitcoin/database/impl/primitives/iterator.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ TEMPLATE
INLINE bool CLASS::is_match() const NOEXCEPT
{
using namespace system;
BC_ASSERT(!is_add_overflow(link_to_position(link_), Link::size));

if (!memory_)
if (link_.is_terminal() || !memory_)
return false;

BC_ASSERT(!is_add_overflow(link_to_position(link_), Link::size));
auto link = memory_->offset(link_to_position(link_) + Link::size);
if (is_null(link))
return false;
Expand Down

0 comments on commit 536f13c

Please sign in to comment.