Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@strega-nil-ms
Copy link
Contributor

Fixes #3883

@strega-nil-ms strega-nil-ms requested a review from a team as a code owner July 17, 2023 21:58
@CaseyCarter CaseyCarter added the bug Something isn't working label Jul 17, 2023
@StephanTLavavej StephanTLavavej added the ASan Address Sanitizer label Jul 18, 2023
Comment on lines 3809 to 3811
const auto _New_size = _Old_size + _Count - _Nx;
_ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
_ASAN_STRING_REMOVE(*this);
_Mypair._Myval2._Mysize = _New_size;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change requested: We could fuse _New_size now, or move its definition below the _ASAN_STRING_REMOVE. This is fine as-is though.

@StephanTLavavej StephanTLavavej self-assigned this Jul 20, 2023
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 8a93121 into microsoft:main Jul 20, 2023
@StephanTLavavej
Copy link
Member

Thanks for this important ASAN fix! 🐞 🛠️ 🎉

@strega-nil-ms strega-nil-ms deleted the asan-string-replace branch July 26, 2023 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ASan Address Sanitizer bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<string>: basic_string::replace fails under ASan when pos + count > size, and count2 < count

5 participants