From a43cc4b7e7dfa51b4f1c163f3bf29cd785047bd1 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Wed, 27 May 2026 21:49:01 +0800 Subject: [PATCH] binomial_heap: fix stack-buffer-overflow in merge_and_clear_nodes when this_iterator reaches end() --- include/boost/heap/binomial_heap.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/heap/binomial_heap.hpp b/include/boost/heap/binomial_heap.hpp index a72b342..e8b2828 100644 --- a/include/boost/heap/binomial_heap.hpp +++ b/include/boost/heap/binomial_heap.hpp @@ -686,6 +686,8 @@ try_again: } else { this_iterator = trees.erase( this_iterator ); carry_node = merge_trees( this_node, carry_node ); + if ( this_iterator == trees.end() ) + break; } goto try_again; } else {