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.

See #23305.

(cherry picked from commit 73ad17db4ec9a48e64ed40f5020918ec9a05a8a5)
This commit is contained in:
Ian Day 2023-03-01 14:26:05 +00:00 committed by Vadim Zeitlin
parent 365bea9b07
commit 2aac6d611f
2 changed files with 2 additions and 1 deletions

View File

@ -240,6 +240,7 @@ All:
- Add move ctor and assignment to wxString (Pavel Tyunin, #23224).
- Enable large file support in Unix CMake builds (Maarten Bent, #22750).
- Update Georgian translations (NorwayFun, #22673).
- Don't use invalid iterator in wxString in UTF-8 build (Ian Day, #23305).
All (GUI):

View File

@ -262,7 +262,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;