From 3d2235f97a4d77ceeb6e8bd39542337d96ca6d76 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 19 Feb 2026 07:42:19 -0800 Subject: [PATCH] Fix strict weak ordering violation in ASSERT_CACHE_KEY::operator< The comparator used logical OR between field comparisons, which violates the asymmetry requirement of strict weak ordering. Two keys with different orderings across fields could both compare as less-than each other, causing undefined behavior in the std::set that deduplicates assert messages. Replace with proper lexicographic comparison. --- common/app_monitor.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/app_monitor.cpp b/common/app_monitor.cpp index 93d5c6b90b..d29e990511 100644 --- a/common/app_monitor.cpp +++ b/common/app_monitor.cpp @@ -320,7 +320,16 @@ SENTRY* SENTRY::m_instance = nullptr; bool operator<( const ASSERT_CACHE_KEY& aKey1, const ASSERT_CACHE_KEY& aKey2 ) { - return aKey1.file < aKey2.file || aKey1.line < aKey2.line || aKey1.func < aKey2.func || aKey1.cond < aKey2.cond; + if( aKey1.file != aKey2.file ) + return aKey1.file < aKey2.file; + + if( aKey1.line != aKey2.line ) + return aKey1.line < aKey2.line; + + if( aKey1.func != aKey2.func ) + return aKey1.func < aKey2.func; + + return aKey1.cond < aKey2.cond; }