Skip to content

Commit 4bd66db

Browse files
authored
Add "Remarks" heading in AddressSanitizer error references
1 parent 98ae959 commit 4bd66db

18 files changed

+36
-0
lines changed

docs/sanitizers/error-alloc-dealloc-mismatch.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ helpviewer_keywords: ["alloc-dealloc-mismatch error", "AddressSanitizer error al
99

1010
> Address Sanitizer Error: Mismatch between allocation and deallocation APIs
1111
12+
## Remarks
13+
1214
Enables runtime detection of mismatched memory operations that may lead to undefined behavior, such as:
1315
- `malloc` must be paired with `free`, not `delete` or `delete[]`.
1416
- `new` must be paired with `delete`, not `free` or `delete[]`.

docs/sanitizers/error-allocation-size-too-big.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ helpviewer_keywords: ["allocation-size-too-big error", "AddressSanitizer error a
1010

1111
> Address Sanitizer Error: allocation-size-too-big
1212
13+
## Remarks
14+
1315
This example shows the error found when an allocation is too large for the heap. Example sourced from [LLVM compiler-rt test suite](https://github.com/llvm/llvm-project/tree/main/compiler-rt/test/asan/TestCases).
1416

1517
## Example

docs/sanitizers/error-calloc-overflow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ helpviewer_keywords: ["calloc-overflow error", "AddressSanitizer error calloc-ov
99

1010
> Address Sanitizer Error: calloc-overflow
1111
12+
## Remarks
13+
1214
The CRT function [`calloc`](../c-runtime-library/reference/calloc.md) creates an array in memory with elements initialized to 0. The arguments can create an internal error that leads to a NULL pointer as the return value.
1315

1416
## Example

docs/sanitizers/error-container-overflow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ helpviewer_keywords: ["container-overflow error", "AddressSanitizer error contai
1010

1111
> Address Sanitizer Error: Container overflow
1212
13+
## Remarks
14+
1315
In Visual Studio 2022 version 17.2 and later, the Microsoft Visual C++ standard library (STL) is partially enlightened to work with the AddressSanitizer. The following container types have annotations to detect memory access issues:
1416

1517
| Standard container type | Disable annotations macro | Supported in version |

docs/sanitizers/error-double-free.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ ms.custom: sfi-image-nochange
1111

1212
> Address Sanitizer Error: Deallocation of freed memory
1313
14+
## Remarks
15+
1416
In C, you can call `free` erroneously. In C++, you can call `delete` more than once. In these examples, we show errors with `delete`, `free`, and `HeapCreate`.
1517

1618
## Example C++ - double `operator delete`

docs/sanitizers/error-dynamic-stack-buffer-overflow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ helpviewer_keywords: ["dynamic-stack-buffer-overflow error", "AddressSanitizer e
99

1010
> Address Sanitizer Error: dynamic-stack-buffer-overflow
1111
12+
## Remarks
13+
1214
This example shows the error that results from a buffer access outside the bounds of a stack-allocated object.
1315

1416
## Example - `alloca` overflow (right)

docs/sanitizers/error-global-buffer-overflow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ helpviewer_keywords: ["global-buffer-overflow error", "AddressSanitizer error gl
99

1010
> Address Sanitizer Error: Global buffer overflow
1111
12+
## Remarks
13+
1214
The compiler generates metadata for any variable in the `.data` or `.bss` sections. These variables have language scope of global or file static. They're allocated in memory before `main()` starts. Global variables in C are treated much differently than in C++. This difference is because of the complex rules for linking C.
1315

1416
In C, a global variable can be declared in several source files, and each definition can have different types. The compiler can't see all the possible definitions at once, but the linker can. For C, the linker defaults to selecting the largest-sized variable out of all the different declarations.

docs/sanitizers/error-heap-buffer-overflow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ helpviewer_keywords: ["heap-buffer-overflow error", "AddressSanitizer error heap
99

1010
> Address Sanitizer Error: Heap buffer overflow
1111
12+
## Remarks
13+
1214
This example demonstrates the error that results when a memory access occurs outside the bounds of a heap-allocated object.
1315

1416
## Example - classic heap buffer overflow

docs/sanitizers/error-heap-use-after-free.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ helpviewer_keywords: ["heap-use-after-free error", "AddressSanitizer error heap-
99

1010
> Address Sanitizer Error: Use of deallocated memory
1111
12+
## Remarks
13+
1214
We show three examples where storage in the heap can be allocated via `malloc`, `realloc` (C), and `new` (C++), along with a mistaken use of `volatile`.
1315

1416
## Example - `malloc`

docs/sanitizers/error-invalid-allocation-alignment.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ helpviewer_keywords: ["invalid-allocation-alignment error", "AddressSanitizer er
99

1010
> Address Sanitizer Error: invalid-allocation-alignment
1111
12+
## Remarks
13+
1214
The [`_aligned_malloc`](../c-runtime-library/reference/aligned-malloc.md) function requires a power of 2 for expressing the alignment. We simulate the "external" calculation of some alignment factor using an unoptimized global variable.
1315

1416
## Example

0 commit comments

Comments
 (0)