From f5cae044d0fb824aebdd830b359cda32e32a2140 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh <stambaughw@gmail.com> Date: Thu, 20 Mar 2025 11:16:02 -0400 Subject: [PATCH] Fix Coverity issue #545159 and all related issues. Don't use fmt::format() when formatting wxString objects. It will throw an exception on an argument type mismatch which isn't handled in most code paths. This also prevents the conversion of the fmt::format() arguments from wxString to std::string and the result from std::string back to wxString for the return value. https://scan8.scan.coverity.com/#/project-view/22886/10844?selectedIssue=545159 --- common/lib_id.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib_id.cpp b/common/lib_id.cpp index 0247bb07c0..fe3a565d4b 100644 --- a/common/lib_id.cpp +++ b/common/lib_id.cpp @@ -275,7 +275,7 @@ bool LIB_ID::isLegalLibraryNameChar( unsigned aUniChar ) const wxString LIB_ID::GetFullLibraryName() const { if( m_subLibraryName.empty() ) - return m_libraryName.c_str(); + return m_libraryName; - return fmt::format( "{} - {}", m_libraryName.c_str(), m_subLibraryName.c_str() ); + return wxString::Format( wxS( "%s - %s" ), m_libraryName.c_str(), m_subLibraryName.c_str() ); }