From 6d9e0482b43893ab9275d3570052542f6142329d Mon Sep 17 00:00:00 2001 From: chaoticgd <43898262+chaoticgd@users.noreply.github.com> Date: Mon, 24 Nov 2025 11:35:55 +0000 Subject: [PATCH] Debugger: Fix memory explosion due to wrapped address range --- 3rdparty/ccc/src/ccc/symbol_database.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/3rdparty/ccc/src/ccc/symbol_database.cpp b/3rdparty/ccc/src/ccc/symbol_database.cpp index 87b1e7d015..6242e50bc4 100644 --- a/3rdparty/ccc/src/ccc/symbol_database.cpp +++ b/3rdparty/ccc/src/ccc/symbol_database.cpp @@ -113,13 +113,27 @@ typename SymbolList::AddressToHandleMapIterators SymbolList typename SymbolList::AddressToHandleMapIterators SymbolList::handles_from_address_range(AddressRange range) const { - if(range.low.valid()) { - return {m_address_to_handle.lower_bound(range.low.value), m_address_to_handle.lower_bound(range.high.value)}; - } else if(range.high.valid()) { - return {m_address_to_handle.begin(), m_address_to_handle.lower_bound(range.high.value)}; + typename AddressToHandleMap::const_iterator begin, end; + if (range.low.valid() && range.high.valid()) { + if (range.low.value < range.high.value) { + begin = m_address_to_handle.lower_bound(range.low.value); + end = m_address_to_handle.lower_bound(range.high.value); + } else { + begin = m_address_to_handle.end(); + end = m_address_to_handle.end(); + } + } else if (range.low.valid()) { + begin = m_address_to_handle.lower_bound(range.low.value); + end = m_address_to_handle.end(); + } else if (range.high.valid()) { + begin = m_address_to_handle.begin(); + end = m_address_to_handle.lower_bound(range.high.value); } else { - return {m_address_to_handle.end(), m_address_to_handle.end()}; + begin = m_address_to_handle.end(); + end = m_address_to_handle.end(); } + + return {begin, end}; } template