Fix unchecked replacement

This commit is contained in:
Krystian Stasiowski
2020-02-01 13:50:50 -05:00
parent 70779748a3
commit ec525b20d2

View File

@ -1964,7 +1964,7 @@ public:
size_type pos2, size_type pos2,
size_type n2 = npos) BOOST_STATIC_STRING_NO_EXCEPTIONS_NOEXCEPT size_type n2 = npos) BOOST_STATIC_STRING_NO_EXCEPTIONS_NOEXCEPT
{ {
return replace_unchecked(pos1, n1, str.data() + pos2, (std::min)(n2, str.size() - pos2)); return replace(pos1, n1, str.data() + pos2, (std::min)(n2, str.size() - pos2));
} }
/** Replace a substring with a substring. /** Replace a substring with a substring.
@ -2006,7 +2006,7 @@ public:
size_type pos2, size_type pos2,
size_type n2 = npos) BOOST_STATIC_STRING_NO_EXCEPTIONS_NOEXCEPT size_type n2 = npos) BOOST_STATIC_STRING_NO_EXCEPTIONS_NOEXCEPT
{ {
return replace(pos1, n1, str.data() + pos2, (std::min)(n2, str.size() - pos2)); return replace_unchecked(pos1, n1, str.data() + pos2, (std::min)(n2, str.size() - pos2));
} }
/** Replace a substring with an object convertible to `string_view_type`. /** Replace a substring with an object convertible to `string_view_type`.