From 73ad17db4ec9a48e64ed40f5020918ec9a05a8a5 Mon Sep 17 00:00:00 2001 From: Ian Day Date: Wed, 1 Mar 2023 14:26:05 +0000 Subject: [PATCH] Fix dereferencing invalid iterator in wxString in UTF-8 build Fix iterator going past end of string in PosLenToImpl, it can't become end() as the end iterator can't be dereferenced. Closes #23305. --- src/common/string.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/string.cpp b/src/common/string.cpp index 64b7ae6be2..009cd2abea 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -229,7 +229,7 @@ void wxString::PosLenToImpl(size_t pos, size_t len, // going beyond the end of the string, just as std::string does const const_iterator e(end()); const_iterator i(b); - while ( len && i <= e ) + while ( len && i < e ) { ++i; --len;