From f1bd349ba7de81fcc56fd23670ce49ff4dd42a52 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 4 Nov 2024 23:16:07 +0000 Subject: [PATCH] Fix accessing invalid iterator in historical state (#6609) --- src/node/historical_queries.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/historical_queries.h b/src/node/historical_queries.h index 5c987ce37f2d..06d822ae357a 100644 --- a/src/node/historical_queries.h +++ b/src/node/historical_queries.h @@ -265,14 +265,14 @@ namespace ccf::historical auto new_it = new_seqnos.begin(); while (new_it != new_seqnos.end()) { - if (*new_it == prev_it->first) + if (prev_it != my_stores.end() && *new_it == prev_it->first) { // Asking for a seqno which was also requested previously - do // nothing and advance to compare next entries ++new_it; ++prev_it; } - else if (*new_it > prev_it->first) + else if (prev_it != my_stores.end() && *new_it > prev_it->first) { // No longer looking for a seqno which was previously requested. // Remove it from my_stores