-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix string::replace
under ASan
#3884
Merged
StephanTLavavej
merged 3 commits into
microsoft:main
from
strega-nil:asan-string-replace
Jul 20, 2023
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
StephanTLavavej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# This test matrix is the usual test matrix, with all currently unsupported options removed, crossed with the ASan flags. | ||
|
||
# TRANSITION, google/sanitizers#328 - clang-cl does not currently support targeting /MDd or /MTd. | ||
RUNALL_INCLUDE ..\prefix.lst | ||
RUNALL_CROSSLIST | ||
PM_CL="/Zi /wd4611 /w14640 /Zc:threadSafeInit-" PM_LINK="/debug" | ||
RUNALL_CROSSLIST | ||
PM_CL="-fsanitize=address /BE /c /EHsc /MD /std:c++14" | ||
PM_CL="-fsanitize=address /BE /c /EHsc /MDd /std:c++17 /permissive-" | ||
PM_CL="-fsanitize=address /BE /c /EHsc /MT /std:c++20 /permissive-" | ||
PM_CL="-fsanitize=address /BE /c /EHsc /MTd /std:c++latest /permissive-" | ||
PM_CL="-fsanitize=address /EHsc /MD /std:c++14" | ||
PM_CL="-fsanitize=address /EHsc /MD /std:c++17" | ||
PM_CL="-fsanitize=address /EHsc /MD /std:c++20" | ||
PM_CL="-fsanitize=address /EHsc /MD /std:c++latest /permissive- /Zc:char8_t- /Zc:preprocessor" | ||
PM_CL="-fsanitize=address /EHsc /MD /std:c++latest /permissive- /Zc:noexceptTypes-" | ||
PM_CL="-fsanitize=address /EHsc /MDd /std:c++14 /fp:except /Zc:preprocessor" | ||
PM_CL="-fsanitize=address /EHsc /MDd /std:c++17 /permissive-" | ||
PM_CL="-fsanitize=address /EHsc /MDd /std:c++20 /permissive-" | ||
PM_CL="-fsanitize=address /EHsc /MDd /std:c++latest /permissive- /Zc:wchar_t-" | ||
PM_CL="-fsanitize=address /EHsc /MDd /std:c++latest /permissive-" | ||
PM_CL="-fsanitize=address /EHsc /MT /std:c++latest /permissive- /analyze:only /analyze:autolog-" | ||
PM_CL="-fsanitize=address /EHsc /MT /std:c++latest /permissive-" | ||
PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive" | ||
PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive- /analyze:only /analyze:autolog-" | ||
PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive- /fp:strict" | ||
PM_CL="-fsanitize=address /EHsc /MTd /std:c++latest /permissive-" | ||
PM_CL="/D_ANNOTATE_STRING /BE /c /EHsc /MD /std:c++14" | ||
PM_CL="/D_ANNOTATE_STRING /BE /c /EHsc /MDd /std:c++17 /permissive-" | ||
PM_CL="/D_ANNOTATE_STRING /BE /c /EHsc /MT /std:c++20 /permissive-" | ||
PM_CL="/D_ANNOTATE_STRING /BE /c /EHsc /MTd /std:c++latest /permissive-" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++14" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++14 /Zc:char8_t" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++17" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++17 /Zc:char8_t" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++20" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++latest /permissive- /Zc:char8_t- /Zc:preprocessor" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MD /std:c++latest /permissive- /Zc:noexceptTypes-" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MDd /std:c++14 /fp:except /Zc:preprocessor" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MDd /std:c++17 /permissive-" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MDd /std:c++20 /permissive-" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MDd /std:c++latest /permissive- /Zc:wchar_t-" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MDd /std:c++latest /permissive-" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MT /std:c++latest /permissive- /analyze:only /analyze:autolog-" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MT /std:c++latest /permissive-" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MTd /std:c++latest /permissive" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MTd /std:c++latest /permissive- /analyze:only /analyze:autolog-" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MTd /std:c++latest /permissive- /fp:strict" | ||
PM_CL="/D_ANNOTATE_STRING /EHsc /MTd /std:c++latest /permissive-" | ||
# TRANSITION, clang-cl does not support /alternatename so we cannot test /D_ANNOTATE_STRING without -fsanitize=address | ||
PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++14" | ||
PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++17" | ||
PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive-" | ||
PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++latest /permissive- /fp:strict" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <string> | ||
|
||
int main() { | ||
std::string t = "0123456789ABCDEF"; // large string | ||
t.replace(0, 30, 7, 'A'); | ||
StephanTLavavej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.