mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-28 16:24:27 +02:00
Fix crash in regex search
Avoid unhandled std::range_error exceptions in case of an text input issue by providing an user-supplied byte-error string see https://en.cppreference.com/w/cpp/locale/wstring_convert/from_bytes and https://en.cppreference.com/w/cpp/locale/wstring_convert/to_bytes Fix #10773, close #10783
This commit is contained in:
parent
a22a0bfedf
commit
f52c2b022d
@ -1223,7 +1223,7 @@ bool isAssoCommandExisting(LPCTSTR FullPathName)
|
|||||||
std::wstring s2ws(const std::string& str)
|
std::wstring s2ws(const std::string& str)
|
||||||
{
|
{
|
||||||
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
||||||
std::wstring_convert<convert_typeX, wchar_t> converterX;
|
std::wstring_convert<convert_typeX, wchar_t> converterX("Error in N++ string conversion s2ws!", L"Error in N++ string conversion s2ws!");
|
||||||
|
|
||||||
return converterX.from_bytes(str);
|
return converterX.from_bytes(str);
|
||||||
}
|
}
|
||||||
@ -1231,7 +1231,7 @@ std::wstring s2ws(const std::string& str)
|
|||||||
std::string ws2s(const std::wstring& wstr)
|
std::string ws2s(const std::wstring& wstr)
|
||||||
{
|
{
|
||||||
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
||||||
std::wstring_convert<convert_typeX, wchar_t> converterX;
|
std::wstring_convert<convert_typeX, wchar_t> converterX("Error in N++ string conversion ws2s!", L"Error in N++ string conversion ws2s!");
|
||||||
|
|
||||||
return converterX.to_bytes(wstr);
|
return converterX.to_bytes(wstr);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user