From ff3c57c8d3f7b552fd9512c34d7a53e32fedfd43 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 14 Jul 2026 21:21:45 +0200 Subject: [PATCH] Category may exist while sections are not filled. Dereference of end() iterator in section category options list (profiler/src/profiler/TracyView_Options.cpp:152-153) The new category list iterates categories = m_worker.GetSectionDescriptions() (the description map) and then looks up each category in sections = m_worker. GetSections(): for( const auto& v : categories ) { ... auto it = sections.find( v.first ); ImGui::TextDisabled( "(%s)", RealToString( it->second.size() ) ); ... } sectionsDescription is a superset of sections's keys: ProcessSectionSetup (server/TracyWorker.cpp:7484-7496) inserts into sectionsDescription only, while ProcessSectionEnter (server/TracyWorker.cpp:7416-7454) inserts into both. A category set up via TracySectionSetup that has no TracySectionEnter events yet (or a saved trace containing such a category) will be in sectionsDescription but not in sections. find returns end() and it->second.size() is undefined behavior (likely crash). --- profiler/src/profiler/TracyView_Options.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiler/src/profiler/TracyView_Options.cpp b/profiler/src/profiler/TracyView_Options.cpp index a32e8634..fba99e6b 100644 --- a/profiler/src/profiler/TracyView_Options.cpp +++ b/profiler/src/profiler/TracyView_Options.cpp @@ -150,7 +150,7 @@ void View::DrawOptions() SmallCheckbox( m_worker.GetSectionCategoryDescription( v.first ), &Vis( v.first ) ); ImGui::SameLine(); auto it = sections.find( v.first ); - ImGui::TextDisabled( "(%s)", RealToString( it->second.size() ) ); + if( it != sections.end() ) ImGui::TextDisabled( "(%s)", RealToString( it->second.size() ) ); ImGui::PopID(); } ImGui::TreePop();