Skip to content

Commit e687303

Browse files
author
Colin Robertson
committed
Integrate with hub, docfx.json
1 parent b927ef7 commit e687303

31 files changed

Lines changed: 231 additions & 204 deletions

‎docs/docfx.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"parallel/openmp/reference/**.md": "reference",
113113
"preprocessor/**.md": "reference",
114114
"safeint/**.md": "reference",
115+
"sanitizers/**.md": "reference",
115116
"standard-library/**.md": "reference",
116117
"windows/attributes/**.md": "reference"
117118
},
@@ -145,6 +146,7 @@
145146
"porting/**.md": "cpp-language",
146147
"preprocessor/**.md": "cpp-language",
147148
"safeint/**.md": "cpp-standard-libraries",
149+
"sanitizers/**.md": "cpp-tools",
148150
"security/**.md": "cpp-windows",
149151
"standard-library/**.md": "cpp-standard-libraries",
150152
"text/**.md": "cpp-windows",
@@ -181,6 +183,7 @@
181183
"porting/**.md": "corob-msft",
182184
"preprocessor/**.md": "corob-msft",
183185
"safeint/**.md": "tylermsft",
186+
"sanitizers/**.md": "corob-msft",
184187
"security/**.md": "corob-msft",
185188
"standard-library/**.md": "tylermsft",
186189
"text/**.md": "tylermsft",
@@ -217,6 +220,7 @@
217220
"porting/**.md": "corob",
218221
"preprocessor/**.md": "corob",
219222
"safeint/**.md": "twhitney",
223+
"sanitizers/**.md": "corob",
220224
"security/**.md": "corob",
221225
"standard-library/**.md": "twhitney",
222226
"text/**.md": "twhitney",

‎docs/index.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,12 @@ additionalContent:
181181
url: /visualstudio/debugger/debugging-native-code
182182
- text: Analyze your code
183183
url: code-quality/index.yml
184-
- text: Improve app performance
184+
- text: Profile app performance
185185
url: /visualstudio/profiling
186186
- text: Port and upgrade code
187187
url: porting/visual-cpp-porting-and-upgrading-guide.md
188+
- text: Sanitize code for bugs
189+
url: sanitizers/index.yml
188190
# Card
189191
- title: Libraries
190192
links:

‎docs/sanitizers/asan-building.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ By default, the MSVC compiler (unlike Clang) doesn't generate code to allocate f
7676

7777
The **`/fsanitize-address-use-after-return`** option causes the compiler to generate code to use a dual stack frame in the heap when locals are considered "address taken". This code is **much slower** than just using **`/fsanitize=address`** alone.
7878

79-
See the [Stack Use After Return example](examples-stack-use-after-return.md) for sample usage.
79+
See the [`stack-use-after-return` error](error-stack-use-after-return.md) for sample usage.
8080

8181
The dual stack frame in the heap remains after the return from the function that created it. Consider an example where the address of a local, allocated to a slot in the heap, is used after the return. The shadow bytes associated with the fake heap frame contain the value 0xf9. That 0xF9 means a stack-use-after-return error when the runtime reports the error.
8282

@@ -141,4 +141,4 @@ To enable this behavior, run the command `set ASAN_VCASAN_DEBUGGING=1` before yo
141141
[AddressSanitizer shadow bytes](./asan-shadowbytes.md)\
142142
[AddressSanitizer cloud or distributed testing](./asan-offline-crash-dumps.md)\
143143
[AddressSanitizer debugger integration](./asan-debugger-integration.md)\
144-
[AddressSanitizer error examples](./asan-examples.md)
144+
[AddressSanitizer error examples](./asan-error-examples.md)

‎docs/sanitizers/asan-debugger-integration.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ Here's what happens when a dump file is specified for `ASAN_SAVE_DUMPS`: If an e
4646
[AddressSanitizer runtime reference](./asan-runtime.md)\
4747
[AddressSanitizer shadow bytes](./asan-shadowbytes.md)\
4848
[AddressSanitizer cloud or distributed testing](./asan-offline-crash-dumps.md)\
49-
[AddressSanitizer error examples](./asan-examples.md)
49+
[AddressSanitizer error examples](./asan-error-examples.md)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: "AddressSanitizer error reference"
3+
description: "Top-level description of the AddressSanitizer errors and examples in Microsoft C/C++."
4+
ms.date: 03/01/2021
5+
helpviewer_keywords: ["ASan error examples", "AddressSanitizer error examples", "Address Sanitizer error examples", "Error examples for AddressSanitizer"]
6+
---
7+
# AddressSanitizer error examples
8+
9+
In this section, we list a set of the errors supported by AddressSanitizer in Microsoft C/C++ (MSVC). In each article, we've ported some examples that help you learn to use the AddressSanitizer features supported by MSVC in your code. These examples are based on sources in the [LLVM compiler-rt test suite](https://github.com/llvm/llvm-project/tree/main/compiler-rt/test/asan/TestCases).
10+
11+
## Build the error examples
12+
13+
Each error example provides source code and compilation instructions for a command-line build. To build each example, open a developer command prompt. Create a folder for your example project, then make it the current directory. Then copy the example code into a source file with the appropriate name, such as *`example1.cpp`*. Follow the build instructions to generate and run the instrumented code in the debugger.
14+
15+
## Errors with examples
16+
17+
- [Error: `alloc-dealloc-mismatch`](./error-alloc-dealloc-mismatch.md)
18+
19+
- [Error: `allocation-size-too-big`](./error-allocation-size-too-big.md)
20+
21+
- [Error: `calloc-overflow`](./error-calloc-overflow.md)
22+
23+
- [Error: `double-free`](./error-double-free.md)
24+
25+
- [Error: `dynamic-stack-buffer-overflow`](./error-dynamic-stack-buffer-overflow.md)
26+
27+
- [Error: `global-overflow`](./error-global-buffer-overflow.md)
28+
29+
- [Error: `heap-buffer-overflow`](./error-heap-buffer-overflow.md)
30+
31+
- [Error: `heap-use-after-free`](./error-heap-use-after-free.md)
32+
33+
- [Error: `invalid-allocation-alignment`](./error-invalid-allocation-alignment.md)
34+
35+
- [Error: `memcpy-param-overlap`](./error-memcpy-param-overlap.md)
36+
37+
- [Error: `new-delete-type-mismatch`](./error-new-delete-type-mismatch.md)
38+
39+
- [Error: `stack-buffer-overflow`](./error-stack-buffer-overflow.md)
40+
41+
- [Error: `stack-buffer-underflow`](./error-stack-buffer-underflow.md)
42+
43+
- [Error: `stack-use-after-return`](./error-stack-use-after-return.md)
44+
45+
- [Error: `stack-use-after-scope`](./error-stack-use-after-scope.md)
46+
47+
- [Error: `strncat-param-overlap`](./error-strncat-param-overlap.md)
48+
49+
- [Error: `use-after-poison`](./error-use-after-poison.md)
50+
51+
## See also
52+
53+
[AddressSanitizer overview](./asan.md)\
54+
[AddressSanitizer known issues](./asan-known-issues.md)\
55+
[AddressSanitizer build and language reference](./asan-building.md)\
56+
[AddressSanitizer runtime reference](./asan-runtime.md)\
57+
[AddressSanitizer shadow bytes](./asan-shadowbytes.md)\
58+
[AddressSanitizer cloud or distributed testing](./asan-offline-crash-dumps.md)\
59+
[AddressSanitizer debugger integration](./asan-debugger-integration.md)

‎docs/sanitizers/asan-examples.md‎

Lines changed: 0 additions & 59 deletions
This file was deleted.

‎docs/sanitizers/asan-known-issues.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ The *`clang_rt.asan*.dll`* runtime files are installed next to the compilers in
6868
[AddressSanitizer shadow bytes](./asan-shadowbytes.md)\
6969
[AddressSanitizer cloud or distributed testing](./asan-offline-crash-dumps.md)\
7070
[AddressSanitizer debugger integration](./asan-debugger-integration.md)\
71-
[AddressSanitizer error examples](./asan-examples.md)
71+
[AddressSanitizer error examples](./asan-error-examples.md)

‎docs/sanitizers/asan-offline-crash-dumps.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ For external documentation, see:
8686
[AddressSanitizer runtime reference](./asan-runtime.md)\
8787
[AddressSanitizer shadow bytes](./asan-shadowbytes.md)\
8888
[AddressSanitizer debugger integration](./asan-debugger-integration.md)\
89-
[AddressSanitizer error examples](./asan-examples.md)
89+
[AddressSanitizer error examples](./asan-error-examples.md)

‎docs/sanitizers/asan-runtime.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,4 @@ The interceptors listed here are only installed when an AddressSanitizer runtime
191191
[AddressSanitizer shadow bytes](./asan-shadowbytes.md)\
192192
[AddressSanitizer cloud or distributed testing](./asan-offline-crash-dumps.md)\
193193
[AddressSanitizer debugger integration](./asan-debugger-integration.md)\
194-
[AddressSanitizer error examples](./asan-examples.md)
194+
[AddressSanitizer error examples](./asan-error-examples.md)

‎docs/sanitizers/asan-shadowbytes.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ Both the code the compiler generates and the AddressSanitizer runtime can write
7878
[AddressSanitizer runtime reference](./asan-runtime.md)\
7979
[AddressSanitizer cloud or distributed testing](./asan-offline-crash-dumps.md)\
8080
[AddressSanitizer debugger integration](./asan-debugger-integration.md)\
81-
[AddressSanitizer error examples](./asan-examples.md)
81+
[AddressSanitizer error examples](./asan-error-examples.md)

0 commit comments

Comments
 (0)