OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 // | |
5 // Defines some functions that intentionally do an invalid memory access in | |
6 // order to trigger an Address Sanitizer (ASAN) error report. | |
Timur Iskhodzhanov
2014/06/05 15:32:09
nit: AddressSanitizer (ASan)
Sébastien Marchand
2014/06/05 19:44:34
Done.
| |
7 | |
8 #ifndef BASE_DEBUG_ASAN_INVALID_ACCESS_H_ | |
9 #define BASE_DEBUG_ASAN_INVALID_ACCESS_H_ | |
10 | |
11 #include "base/compiler_specific.h" | |
12 | |
13 namespace base { | |
14 | |
15 #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN) | |
16 | |
17 // Generates an heap buffer overflow. | |
18 NOINLINE void AsanHeapOverflow(); | |
19 | |
20 // Generates an heap buffer underflow. | |
21 NOINLINE void AsanHeapUnderflow(); | |
22 | |
23 // Generates an use after free. | |
24 NOINLINE void AsanHeapUseAfterFree(); | |
25 | |
26 #endif // ADDRESS_SANITIZER || SYZYASAN | |
27 | |
28 // The "corrupt-block" and "corrupt-heap" classes of bugs is specific to | |
29 // SyzyASan. | |
30 #if defined(SYZYASAN) && defined(COMPILER_MSVC) | |
Timur Iskhodzhanov
2014/06/05 15:32:09
Why do you need COMPILER_MSVC here?
Sébastien Marchand
2014/06/05 19:44:34
It's not needed anymore... I was using __try/__exc
| |
31 | |
32 // Corrupts a memory block and makes sure that the corruption gets detected when | |
33 // we try to free this block. | |
34 NOINLINE void AsanCorruptHeapBlock(); | |
35 | |
36 // Corrupts the heap and makes sure that the corruption gets detected when a | |
37 // crash occur. | |
38 NOINLINE void AsanCorruptHeap(); | |
39 | |
40 #endif // SYZYASAN | |
41 | |
42 } // namespace base | |
43 | |
44 #endif // BASE_DEBUG_ASAN_INVALID_ACCESS_H_ | |
OLD | NEW |