You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
14
16
15
17
## Example
@@ -50,11 +52,11 @@ devenv /debugexe example1.exe
50
52
51
53
## See also
52
54
53
-
[AddressSanitizer overview](./asan.md)\
54
-
[AddressSanitizer known issues](./asan-known-issues.md)\
55
-
[AddressSanitizer build and language reference](./asan-building.md)\
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.
13
15
14
16
## Example
@@ -45,11 +47,11 @@ devenv /debugexe example1.exe
45
47
46
48
## See also
47
49
48
-
[AddressSanitizer overview](./asan.md)\
49
-
[AddressSanitizer known issues](./asan-known-issues.md)\
50
-
[AddressSanitizer build and language reference](./asan-building.md)\
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:
14
16
15
17
| Standard container type | Disable annotations macro | Supported in version |
@@ -90,11 +92,11 @@ If you want the implementation to trust that your custom allocator is handling t
90
92
91
93
## See also
92
94
93
-
[AddressSanitizer overview](./asan.md)\
94
-
[AddressSanitizer known issues](./asan-known-issues.md)\
95
-
[AddressSanitizer build and language reference](./asan-building.md)\
Copy file name to clipboardExpand all lines: docs/sanitizers/error-double-free.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ ms.custom: sfi-image-nochange
11
11
12
12
> Address Sanitizer Error: Deallocation of freed memory
13
13
14
+
## Remarks
15
+
14
16
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`.
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.
13
15
14
16
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.
> Address Sanitizer Error: Use of deallocated memory
11
11
12
+
## Remarks
13
+
12
14
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`.
13
15
14
16
## Example - `malloc`
@@ -144,11 +146,11 @@ The exception thrown dialog points to line 12, *x = 42, and says: Address Saniti
144
146
145
147
## See also
146
148
147
-
[AddressSanitizer overview](./asan.md)\
148
-
[AddressSanitizer known issues](./asan-known-issues.md)\
149
-
[AddressSanitizer build and language reference](./asan-building.md)\
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.
13
15
14
16
## Example
@@ -42,11 +44,11 @@ devenv /debugexe example1.exe
42
44
43
45
## See also
44
46
45
-
[AddressSanitizer overview](./asan.md)\
46
-
[AddressSanitizer known issues](./asan-known-issues.md)\
47
-
[AddressSanitizer build and language reference](./asan-building.md)\
0 commit comments