Protected std::min/max calls

This commit is contained in:
Krystian Stasiowski
2019-10-30 14:05:52 -04:00
parent 0f2ac40d48
commit 7a8a158857
2 changed files with 2 additions and 4 deletions

View File

@ -589,7 +589,7 @@ replace(
if (pos > size())
BOOST_FIXED_STRING_THROW(std::out_of_range{
"pos > size()"});
if (size() - std::min(n1, size() - pos) >= max_size() - n2)
if (size() - (std::min)(n1, size() - pos) >= max_size() - n2)
BOOST_FIXED_STRING_THROW(std::length_error{
"replaced string exceeds max_size()"});
if (pos + n1 >= size())
@ -638,7 +638,7 @@ replace(
if (pos > size())
BOOST_FIXED_STRING_THROW(std::out_of_range{
"pos > size()"});
if (size() - std::min(n1, size() - pos) >= max_size() - n2)
if (size() - (std::min)(n1, size() - pos) >= max_size() - n2)
BOOST_FIXED_STRING_THROW(std::length_error{
"replaced string exceeds max_size()"});
if (pos + n1 >= size())