Skip to content

Repo sync for protected CLA branch #3868

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

Merged
merged 141 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
1f88ecf
correction regarding CStringA
Feb 9, 2021
b143bd3
Merge branch 'master' of https://github.com/MicrosoftDocs/cpp-docs-pr…
Mar 4, 2021
f73939d
Update open-wopen.md
Mar 16, 2022
de0853c
Update other pages that mention _O_TEMPORARY effects.
Mar 16, 2022
f25693d
New article - IDL method wizard
rachana-satao Mar 24, 2022
1598abc
update after review
rachana-satao Mar 25, 2022
47d6ec8
update after review
rachana-satao Mar 25, 2022
30759a9
Update after review
rachana-satao Mar 30, 2022
af577aa
Update after review
rachana-satao Mar 30, 2022
e16d267
Updating - Add property wizard for VS2022
rachana-satao Mar 31, 2022
e8ae819
Updating broken links
rachana-satao Mar 31, 2022
597ba8a
Update after review
rachana-satao Mar 31, 2022
32568f2
Update after review
rachana-satao Apr 1, 2022
e02df78
New article - Add an IDL Property
rachana-satao Apr 4, 2022
f1cc1c6
link updation
rachana-satao Apr 4, 2022
f9474a3
Update after review
rachana-satao Apr 4, 2022
917c232
update after review
rachana-satao Apr 5, 2022
5d17bc2
update after review
rachana-satao Apr 5, 2022
3279a67
New article - IDL MFC property wizard
rachana-satao Apr 6, 2022
75c4080
Broken link fixed
atikmapari Apr 6, 2022
42620c6
Broken link fixed
atikmapari Apr 6, 2022
3ffd4bd
Merge pull request #4205 from atikmapari/Broken-link-corob
Apr 6, 2022
16f64aa
Merge pull request #4204 from atikmapari/Broken-link-twhitney
PRMerger19 Apr 6, 2022
b5d0d5b
Update virtual-functions.md
homing1 Apr 7, 2022
d8ba6d3
Merge pull request #4206 from homing1/patch-1
PRMerger5 Apr 7, 2022
e5a808b
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
rachana-satao Apr 7, 2022
8038fc0
update for links
rachana-satao Apr 7, 2022
8716fee
Updating links
rachana-satao Apr 7, 2022
703fb07
Address cpp-docs 3780 3782 3790 3791 3805
Apr 7, 2022
4c8f34c
Attempt correction of table format
Apr 7, 2022
e923d0d
Merge pull request #4207 from corob-msft/docs/corob/cr124-2
v-regandowner Apr 7, 2022
fb52222
Add documentation for compiler error C2956 and update error text (#4176)
joemmett Apr 7, 2022
bee0ae3
Address cpp-docs 3816
Apr 7, 2022
f9f9ed8
Address non-blocking issues from 4207
Apr 7, 2022
14417cd
Merge pull request #4209 from corob-msft/docs/corob/cpp-docs-3816
tamarakhader Apr 7, 2022
fd5cb9b
fix for sample program.
Apr 7, 2022
1db7404
Merge pull request #4210 from corob-msft/docs/corob/4207-non-blocking
v-regandowner Apr 7, 2022
b28fc04
Merge pull request #4211 from TylerMSFT/github2116
PRMerger5 Apr 7, 2022
d6d4c47
Merge pull request #4181 from stwish-msft/patch-7
PRMerger17 Apr 8, 2022
3ed82bc
Merge branch 'live' into main
Taojunshen Apr 8, 2022
95d8fc0
Merge branch 'main' into FromPublicMasterBranch
Apr 8, 2022
e7edbd7
Merge pull request #4213 from MicrosoftDocs/FromPublicMasterBranch
Apr 8, 2022
33bd140
edits
Apr 8, 2022
63df575
edit pass. Move to ide location
Apr 8, 2022
ca7c749
minor edit
Apr 9, 2022
ea60c43
fix link
Apr 9, 2022
eb41540
Final update
rachana-satao Apr 11, 2022
3226fd2
final update
rachana-satao Apr 11, 2022
e697e37
final update
rachana-satao Apr 11, 2022
d124e97
Merge pull request #4198 from rachana-satao/RAS-add-property-1921541-1
PMEds28 Apr 11, 2022
4f29d9c
resolving blocking issue
rachana-satao Apr 11, 2022
d49033c
resolving blocking issue
rachana-satao Apr 11, 2022
38433b6
Merge pull request #4201 from rachana-satao/RAS-add-adl-property-1921…
PMEds28 Apr 11, 2022
e605bae
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
rachana-satao Apr 11, 2022
336fce2
ToC update for new article
rachana-satao Apr 11, 2022
efabed7
ToC update
rachana-satao Apr 11, 2022
3dd4bd3
link update
rachana-satao Apr 11, 2022
50831db
Merge pull request #4215 from MicrosoftDocs/FromPublicMasterBranch
Apr 11, 2022
306a4e6
Update in alt-text
rachana-satao Apr 12, 2022
479ead5
Update in alt-text
rachana-satao Apr 12, 2022
4d22756
Final Update- See also section
rachana-satao Apr 12, 2022
0bdc759
Merge pull request #4216 from MicrosoftDocs/FromPublicMasterBranch
Apr 12, 2022
6053572
edit pass
Apr 12, 2022
a01c44c
edit pass
Apr 12, 2022
b6cb5c3
more cleanup
Apr 12, 2022
dd897f9
typo
Apr 12, 2022
6adc9c0
small edit
Apr 12, 2022
7d05532
Final update
rachana-satao Apr 13, 2022
cd83167
Merge pull request #4189 from rachana-satao/RAS-cpp-US1921538-2
PMEds28 Apr 13, 2022
6438312
edit pass
Apr 13, 2022
bc70e28
edit pass
Apr 13, 2022
8ea9ce2
formatting for scannability
Apr 13, 2022
7be62e7
acrolinx
Apr 13, 2022
b718153
one more try at spacing
Apr 13, 2022
0e90be9
final update
rachana-satao Apr 14, 2022
efd3dc2
Merge pull request #4203 from rachana-satao/RAS-add-idl-mfc-property-…
v-ccolin Apr 14, 2022
8febc08
edit and add links
Apr 14, 2022
73c30e8
fix links
Apr 14, 2022
d45bab8
Merge pull request #4220 from TylerMSFT/twhitney-example-n-links
v-regandowner Apr 14, 2022
6043bd8
add code example
Apr 14, 2022
2b02b4d
Merge pull request #4222 from TylerMSFT/twhitney-steadyclock
v-regandowner Apr 14, 2022
e166e8d
Merge pull request #4221 from MicrosoftDocs/FromPublicMasterBranch
Apr 14, 2022
371e5e9
click->tick
Apr 14, 2022
7b39040
Another go at updating the description
Apr 14, 2022
18acf1b
Fix stray double-quote
Apr 15, 2022
1c6764b
Merge pull request #4224 from MicrosoftDocs/FromPublicMasterBranch
PRMerger8 Apr 15, 2022
c6608f9
Merge pull request #4223 from TylerMSFT/twhitney-click
PRMerger8 Apr 15, 2022
68ba37a
Address issue in DD PR 1393452
Apr 15, 2022
9cdda21
Merge pull request #4228 from corob-msft/docs/corob/fix-dd-1524526
PRMerger10 Apr 15, 2022
9fedec9
add /interface and /internal-partition - draft (#4227)
TylerMSFT Apr 15, 2022
5f3445d
Clarify when _matherr will be invoked (#4230)
Apr 18, 2022
ac6201a
acrolinx and other fixes
Apr 18, 2022
24b590a
fix typo
Apr 18, 2022
9b0d6e4
more code escape
Apr 18, 2022
04cadb3
another code escape
Apr 18, 2022
474b655
better formatting for retval possibilities
Apr 18, 2022
7a5ac4b
fix backslashes
Apr 18, 2022
b547abc
Merge pull request #4231 from MicrosoftDocs/FromPublicMasterBranch
Apr 18, 2022
a9b9c30
incorp feedback
Apr 18, 2022
fa9cad9
Merge pull request #4232 from TylerMSFT/twhitney-fixes
denrea Apr 18, 2022
687a4a9
SEO work
Apr 19, 2022
53a44eb
acrolinx
Apr 19, 2022
36f1c13
SEO work (#4234)
TylerMSFT Apr 19, 2022
5f3304b
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Apr 19, 2022
6df58bc
SEO work
Apr 19, 2022
a9459aa
incorp feedback
Apr 20, 2022
06f4a20
better link description
Apr 20, 2022
757b597
incorp review feedback
Apr 20, 2022
6f93d37
fix location of graphic
Apr 20, 2022
836f3f2
Merge pull request #4235 from TylerMSFT/seo
AnnaMHuff Apr 21, 2022
a892289
fix github issue#3845
Apr 21, 2022
2fdce31
Merge branch 'live' into main
Taojunshen Apr 21, 2022
290c5e2
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Apr 21, 2022
1018eab
acrolinx
Apr 21, 2022
cbde9af
Merge pull request #4238 from TylerMSFT/twhitney-3845
PRMerger13 Apr 21, 2022
196b4cb
Merge pull request #4240 from MicrosoftDocs/FromPublicMasterBranch
Apr 21, 2022
4f5a5a8
Twhitney seo (#4239)
TylerMSFT Apr 21, 2022
ee98658
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Apr 21, 2022
760484b
add info about converting narrow and wide strings
Apr 21, 2022
9a81105
fix link
Apr 21, 2022
4f8b5eb
fix another link
Apr 21, 2022
2c9145c
Fixes for F1 issues in DD 1524526
Apr 21, 2022
4307e63
minor cleanup
Apr 22, 2022
8ac3a3b
Minimal acrolinx fixes
Apr 22, 2022
84a5131
Merge pull request #4242 from corob-msft/docs/corob/f1-fixes-0415
Apr 22, 2022
23da94e
acrolinx
Apr 22, 2022
99adbf4
minor cleanup
Apr 22, 2022
d18caaa
acrolinx
Apr 22, 2022
694c198
going for 100% acrolinx
Apr 22, 2022
b91c0c1
incorp feedback
Apr 22, 2022
f73d6f4
Merge pull request #4241 from TylerMSFT/twhitney-github2746
PRMerger7 Apr 22, 2022
dccf9b5
make instructions for control panel slightly better
Apr 22, 2022
26070c8
Merge pull request #4244 from TylerMSFT/twhitney-github2746
PRMerger-2 Apr 22, 2022
49e35db
Edits to improve SEO and usability (#4246)
TimShererWithAquent Apr 27, 2022
d4d2162
Merge pull request #4249 from MicrosoftDocs/FromPublicMasterBranch
Apr 28, 2022
b4b052c
Edits to improve SEO and usability
TimShererWithAquent Apr 28, 2022
f96b523
Update ms.date.
TimShererWithAquent Apr 29, 2022
829e952
Merge pull request #4253 from TimShererWithAquent/t596438c
tamarakhader Apr 29, 2022
0b3425f
Add container-overflow ASAN error page (#4226)
May 1, 2022
5157082
Merge pull request #4252 from MicrosoftDocs/FromPublicMasterBranch
May 2, 2022
5fee611
Merge pull request #4255 from MicrosoftDocs/main
v-alje May 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/code-quality/c26455.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: C26455 DEFAULT_CTOR_NOEXCEPT"
title: C26455
ms.date: 12/14/2018
ms.topic: "conceptual"
description: "Learn more about the C26455 DEFAULT_CTOR_NOEXCEPT C++ Core Guidelines Checker warning. Default constructors shouldn't do anything that can throw."
title: C26455 DEFAULT_CTOR_NOEXCEPT
ms.date: 04/29/2022
ms.topic: reference
f1_keywords: ["C26455"]
helpviewer_keywords: ["C26455"]
ms.assetid: 27e86063-d969-49d8-8912-dcc2dc57249f
author: kylereedmsft
ms.author: kylereed
ms.custom: kr2b-contr-experiment
---
# C26455 DEFAULT_CTOR_NOEXCEPT

Expand Down
9 changes: 5 additions & 4 deletions docs/code-quality/c26456.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: C26456 DONT_HIDE_OPERATORS"
title: C26456
ms.date: 12/14/2018
ms.topic: "conceptual"
description: "Learn more about the C26456 DONT_HIDE_OPERATORS C++ Core Guidelines Checker warning. Hiding base methods is error prone and makes code harder to read."
title: C26456 DONT_HIDE_OPERATORS
ms.date: 04/29/2022
ms.topic: reference
f1_keywords: ["C26456"]
helpviewer_keywords: ["C26456"]
ms.assetid: 3a3ad636-0938-40b5-93ce-169322e2ff23
author: kylereedmsft
ms.author: kylereed
ms.custom: kr2b-contr-experiment
---
# C26456 DONT_HIDE_OPERATORS

Expand Down
10 changes: 6 additions & 4 deletions docs/code-quality/c26476.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
description: "Learn more about: C26476 USE_VARIANT"
title: C26476
ms.date: 12/14/2018
ms.topic: "conceptual"
description: "Learn more about the C26476 USE_VARIANT C++ Core Guidelines Checker warning. Use a type-safe alternative to union, which is preferred in modern code."
title: C26476 USE_VARIANT
ms.date: 04/29/2022
ms.topic: reference
f1_keywords: ["C26476"]
helpviewer_keywords: ["C26476"]
ms.assetid: bb2b3b26-9a84-4d81-8bae-ad9a5577c8a6
author: kylereedmsft
ms.author: kylereed
ms.custom: kr2b-contr-experiment
---

# C26476 USE_VARIANT

`std::variant` provides a type-safe alternative to `union` and should be preferred in modern code.
Expand Down
9 changes: 5 additions & 4 deletions docs/code-quality/c26477.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: C26477 USE_NULLPTR_NOT_CONSTANT"
title: C26477
ms.date: 12/14/2018
ms.topic: "conceptual"
description: "Learn more about the C26477 USE_NULLPTR_NOT_CONSTANT C++ Core Guidelines Checker warning. The nullptr value allows overloads with special null handling."
title: C26477 USE_NULLPTR_NOT_CONSTANT
ms.date: 04/29/2022
ms.topic: reference
f1_keywords: ["C26477"]
helpviewer_keywords: ["C26477"]
ms.assetid: d5395efc-5eb2-4e82-9b45-fcd5ff4577bf
author: kylereedmsft
ms.author: kylereed
ms.custom: kr2b-contr-experiment
---
# C26477 USE_NULLPTR_NOT_CONSTANT

Expand Down
9 changes: 5 additions & 4 deletions docs/code-quality/c26486.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: C26486 LIFETIMES_FUNCTION_PRECONDITION_VIOLATION"
title: C26486
ms.date: 12/14/2018
ms.topic: "conceptual"
description: "Learn more about the C26486 LIFETIMES_FUNCTION_PRECONDITION_VIOLATION C++ Core Guidelines Checker warning. Don't pass an invalid pointer as a parameter."
title: C26486 LIFETIMES_FUNCTION_PRECONDITION_VIOLATION
ms.date: 04/29/2022
ms.topic: reference
f1_keywords: ["C26486"]
helpviewer_keywords: ["C26486"]
ms.assetid: d5395efc-5eb2-4e82-9b45-fcd5ff4577bf
author: kylereedmsft
ms.author: kylereed
ms.custom: kr2b-contr-experiment
---
# C26486 LIFETIMES_FUNCTION_PRECONDITION_VIOLATION

Expand Down
2 changes: 2 additions & 0 deletions docs/sanitizers/asan-error-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Each error example provides source code and compilation instructions for a comma

- [Error: `calloc-overflow`](./error-calloc-overflow.md)

- [Error: `container-overflow`](./error-container-overflow.md)

- [Error: `double-free`](./error-double-free.md)

- [Error: `dynamic-stack-buffer-overflow`](./error-dynamic-stack-buffer-overflow.md)
Expand Down
14 changes: 9 additions & 5 deletions docs/sanitizers/asan-known-issues.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "AddressSanitizer known issues"
description: "Technical description of the AddressSanitizer for Microsoft C/C++ known issues."
ms.date: 03/02/2021
ms.date: 04/15/2022
helpviewer_keywords: ["AddressSanitizer known issues"]
---

Expand All @@ -26,9 +26,11 @@ These options and functionality are incompatible with [`/fsanitize=address`](../

## Standard library support

The MSVC standard library (STL) isn't enlightened to understand the AddressSanitizer. AddressSanitizer exceptions raised in STL code do identify true bugs. However, they aren't as precise as they could be.
The MSVC standard library (STL) is partially enlightened to understand the AddressSanitizer and provide additional checks. For more information, see [container-overflow error](./error-container-overflow.md).

This example demonstrates the lack of precision:
When annotations are disabled or in versions without support, AddressSanitizer exceptions raised in STL code do still identify true bugs. However, they aren't as precise as they could be.

This example demonstrates the lack of precision and the benefits of enabling annotations:

```cpp
// Compile with: cl /fsanitize=address /Zi
Expand All @@ -39,12 +41,14 @@ int main() {
std::vector<int> v(10);
v.reserve(20);

// Currently, MSVC ASan does NOT raise an exception here.
// In versions prior to 17.2, MSVC ASan does NOT raise an exception here.
// While this is an out-of-bounds write to 'v', MSVC ASan
// ensures the write is within the heap allocation size (20).
// With 17.2 and later, MSVC ASan will raise a 'container-overflow' exception:
// ==18364==ERROR: AddressSanitizer: container-overflow on address 0x1263cb8a0048 at pc 0x7ff6466411ab bp 0x005cf81ef7b0 sp 0x005cf81ef7b8
v[10] = 1;

// MSVC ASan DOES raise an exception here, as this write
// Regardless of version, MSVC ASan DOES raise an exception here, as this write
// is out of bounds from the heap allocation.
v[20] = 1;
}
Expand Down
71 changes: 71 additions & 0 deletions docs/sanitizers/error-container-overflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: "Error: container-overflow"
description: "Source examples and live debug screenshots for container overflow errors."
ms.date: 04/15/2022
f1_keywords: ["container-overflow", "mismatch detected for 'annotate_vector'", "_DISABLE_VECTOR_ANNOTATION"]
helpviewer_keywords: ["container-overflow error", "AddressSanitizer error container-overflow", "mismatch detected for 'annotate_vector'", "_DISABLE_VECTOR_ANNOTATION"]
---

# Error: `container-overflow`

> Address Sanitizer Error: Container overflow

In Visual Studio 2022 version 17.2 and later, the MSVC standard library (STL) is partially enlightened to understand the AddressSanitizer. The following container types have inserted extra annotations to detect memory access issues:

| Standard container type | Disable annotations macro | Supported in version |
|--|--|--|
| `std::vector` | `_DISABLE_VECTOR_ANNOTATION` | Visual Studio 2022 17.2 |

When a standard type has annotations enabled, to avoid one-definition-rule (ODR) violations, each static library and object used to link the binary must also enable those annotations. Effectively, you must build those static libraries and objects with AddressSanitizer enabled. Mixing code with different annotation settings causes an error:

```Output
my_static.lib(my_code.obj) : error LNK2038: mismatch detected for 'annotate_vector': value '0' doesn't match value '1' in main.obj
```

To resolve this error, either disable annotations in all projects that use the corresponding macro, or build each project by using **`/fsanitize=address`** and annotations enabled. (Annotations are enabled by default.)

## Example: Access reserved memory in a `std::vector`

```cpp
// Compile with: cl /EHsc /fsanitize=address /Zi
#include <vector>

int main() {
// Create a vector of size 10, but with a capacity of 20.
std::vector<int> v(10);
v.reserve(20);

// In versions prior to 17.2, MSVC ASan does NOT raise an exception here.
// While this is an out-of-bounds write to 'v', MSVC ASan
// ensures the write is within the heap allocation size (20).
// With 17.2 and later, MSVC ASan will raise a 'container-overflow' exception:
// ==18364==ERROR: AddressSanitizer: container-overflow on address 0x1263cb8a0048 at pc 0x7ff6466411ab bp 0x005cf81ef7b0 sp 0x005cf81ef7b8
v[10] = 1;

// Regardless of version, MSVC ASan DOES raise an exception here, as this write
// is out of bounds from the heap allocation.
v[20] = 1;
}
```

To build and test this example, run the following commands in a Visual Studio 2022 version 17.2 or later [Developer command prompt](../build/building-on-the-command-line.md#developer_command_prompt_shortcuts) window:

```cmd
cl /EHsc example1.cpp /fsanitize=address /Zi
devenv /debugexe example1.exe
```

### Error result of reserved memory access in a `std::vector`

:::image type="content" source="media/container-overflow-example-1.png" alt-text="Screenshot of debugger displaying container-overflow error in example 1." lightbox="media/container-overflow-example-1.png":::

## See also

[AddressSanitizer overview](./asan.md)\
[AddressSanitizer known issues](./asan-known-issues.md)\
[AddressSanitizer build and language reference](./asan-building.md)\
[AddressSanitizer runtime reference](./asan-runtime.md)\
[AddressSanitizer shadow bytes](./asan-shadow-bytes.md)\
[AddressSanitizer cloud or distributed testing](./asan-offline-crash-dumps.md)\
[AddressSanitizer debugger integration](./asan-debugger-integration.md)\
[AddressSanitizer error examples](./asan-error-examples.md)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/sanitizers/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ items:
href: ../sanitizers/error-allocation-size-too-big.md
- name: "calloc-overflow error"
href: ../sanitizers/error-calloc-overflow.md
- name: "container-overflow error"
href: ../sanitizers/error-container-overflow.md
- name: "double-free error"
href: ../sanitizers/error-double-free.md
- name: "dynamic-stack-buffer-overflow error"
Expand Down