From 3ed77e0115adb910b6e678ee38b17587266ae923 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 23 Mar 2026 14:09:27 -0700 Subject: [PATCH 1/2] Suppress CodeQL warnings. --- stl/inc/xlocinfo | 1 + stl/src/locale0.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/stl/inc/xlocinfo b/stl/inc/xlocinfo index 290596d8bd..1f0195f029 100644 --- a/stl/inc/xlocinfo +++ b/stl/inc/xlocinfo @@ -183,6 +183,7 @@ public: template , int> = 0> void _From_wide(const wchar_t* const _Right) noexcept { + // CodeQL [SM02986] We are intentionally storing `wchar_t*` as `char*` due to ABI, see GH-5781 if (reinterpret_cast(_Myptr) != _Right) { // new value, discard old and copy new _Tidy(); diff --git a/stl/src/locale0.cpp b/stl/src/locale0.cpp index e47b4e9094..7b176a1edc 100644 --- a/stl/src/locale0.cpp +++ b/stl/src/locale0.cpp @@ -236,6 +236,7 @@ void __CLRCALL_PURE_OR_CDECL _Locinfo::_Locinfo_dtor(_Locinfo* pLocinfo) { // de // so reinterpret_cast is not reliable. _wsetlocale(LC_ALL, L""); } else { + // CodeQL [SM02986] We are intentionally storing `wchar_t*` as `char*` due to ABI, see GH-5781 _wsetlocale(LC_ALL, reinterpret_cast(pLocinfo->_Oldlocname._C_str())); } } From 0d8d58049c83ec531ef656b1f20f35c52f8687de Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 23 Mar 2026 14:15:25 -0700 Subject: [PATCH 2/2] Suppress an additional line, just in case. --- stl/inc/xlocinfo | 1 + 1 file changed, 1 insertion(+) diff --git a/stl/inc/xlocinfo b/stl/inc/xlocinfo index 1f0195f029..e71846c183 100644 --- a/stl/inc/xlocinfo +++ b/stl/inc/xlocinfo @@ -188,6 +188,7 @@ public: _Tidy(); if (_Right) { // new is not empty, copy it + // CodeQL [SM02986] We are intentionally storing `wchar_t*` as `char*` due to ABI, see GH-5781 _Myptr = reinterpret_cast(_STD _Ntcts_dup_dbg(_Right)); } }