@@ -948,7 +948,7 @@ private:
948948 _Traits::assign(_My_data._Bx._Buf[_Count], _Elem());
949949 } else { // _Strat == _Construct_strategy::_From_string
950950#ifdef _INSERT_STRING_ANNOTATION
951- _Traits::copy(_My_data._Bx._Buf, _Arg, _Count + 1);
951+ _Traits::copy(_My_data._Bx._Buf, _Arg, static_cast<size_t>( _Count + 1) );
952952#else // ^^^ _INSERT_STRING_ANNOTATION / !_INSERT_STRING_ANNOTATION vvv
953953 _Traits::copy(_My_data._Bx._Buf, _Arg, _BUF_SIZE);
954954#endif // ^^^ !_INSERT_STRING_ANNOTATION ^^^
@@ -1570,8 +1570,9 @@ public:
15701570 // append _Count * _Ch
15711571 const size_type _Old_size = _Mypair._Myval2._Mysize;
15721572 if (_Count <= _Mypair._Myval2._Myres - _Old_size) {
1573- _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count);
1574- _Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + _Count);
1573+ const auto _New_size = static_cast<size_type>(_Old_size + _Count);
1574+ _ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
1575+ _Mypair._Myval2._Mysize = _New_size;
15751576 _Elem* const _Old_ptr = _Mypair._Myval2._Myptr();
15761577 _Traits::assign(_Old_ptr + _Old_size, static_cast<size_t>(_Count), _Ch);
15771578 _Traits::assign(_Old_ptr[_Old_size + _Count], _Elem());
@@ -1759,8 +1760,9 @@ public:
17591760 _Mypair._Myval2._Check_offset(_Off);
17601761 const size_type _Old_size = _Mypair._Myval2._Mysize;
17611762 if (_Count <= _Mypair._Myval2._Myres - _Old_size) {
1762- _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count);
1763- _Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + _Count);
1763+ const auto _New_size = static_cast<size_type>(_Old_size + _Count);
1764+ _ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
1765+ _Mypair._Myval2._Mysize = _New_size;
17641766 _Elem* const _Old_ptr = _Mypair._Myval2._Myptr();
17651767 _Elem* const _Insert_at = _Old_ptr + _Off;
17661768 _Traits::move(
@@ -2202,8 +2204,9 @@ public:
22022204 _CONSTEXPR20 void push_back(const _Elem _Ch) { // insert element at end
22032205 const size_type _Old_size = _Mypair._Myval2._Mysize;
22042206 if (_Old_size < _Mypair._Myval2._Myres) {
2205- _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + 1);
2206- _Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + 1);
2207+ const auto _New_size = static_cast<size_type>(_Old_size + 1);
2208+ _ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
2209+ _Mypair._Myval2._Mysize = _New_size;
22072210 _Elem* const _Ptr = _Mypair._Myval2._Myptr();
22082211 _Traits::assign(_Ptr[_Old_size], _Ch);
22092212 _Traits::assign(_Ptr[_Old_size + 1], _Elem());
@@ -3026,8 +3029,9 @@ private:
30263029
30273030 const size_type _Old_size = _Mypair._Myval2._Mysize;
30283031 if (_Count <= _Mypair._Myval2._Myres - _Old_size) {
3029- _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count);
3030- _Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + _Count);
3032+ const auto _New_size = static_cast<size_type>(_Old_size + _Count);
3033+ _ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
3034+ _Mypair._Myval2._Mysize = _New_size;
30313035 _Elem* const _Old_ptr = _Mypair._Myval2._Myptr();
30323036 _STD _Traits_move_batch<_Traits>(_Old_ptr + _Old_size, _Ptr, static_cast<size_t>(_Count));
30333037 _Traits::assign(_Old_ptr[_Old_size + _Count], _Elem());
@@ -3088,8 +3092,9 @@ private:
30883092#endif // ^^^ !_HAS_CXX20 ^^^
30893093
30903094 if (_Check_overlap) {
3091- _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count);
3092- _Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + _Count);
3095+ const auto _New_size = static_cast<size_type>(_Old_size + _Count);
3096+ _ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
3097+ _Mypair._Myval2._Mysize = _New_size;
30933098 _Elem* const _Old_ptr = _Mypair._Myval2._Myptr();
30943099 _Elem* const _Insert_at = _Old_ptr + _Off;
30953100 // the range [_Ptr, _Ptr + _Ptr_shifted_after) is left alone by moving the suffix out,
@@ -3159,8 +3164,9 @@ private:
31593164#endif // _HAS_CXX20
31603165 {
31613166 if (_Growth <= _Mypair._Myval2._Myres - _Old_size) { // growth fits
3162- _ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Growth);
3163- _Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + _Growth);
3167+ const auto _New_size = static_cast<size_type>(_Old_size + _Growth);
3168+ _ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
3169+ _Mypair._Myval2._Mysize = _New_size;
31643170 _Elem* const _Old_ptr = _Mypair._Myval2._Myptr();
31653171 _Elem* const _Insert_at = _Old_ptr + _Off;
31663172 _Elem* const _Suffix_at = _Insert_at + _Nx;
0 commit comments