| 6 | // order to trigger an AddressSanitizer (ASan) error report. |
| 7 |
| 8 | #ifndef BASE_DEBUG_ASAN_INVALID_ACCESS_H_ |
| 9 | #define BASE_DEBUG_ASAN_INVALID_ACCESS_H_ |
| 10 |
| 11 | #include "base/base_export.h" |
| 12 | #include "base/compiler_specific.h" |
| 13 | #include "base/sanitizer_buildflags.h" |
| 14 | #include "build/build_config.h" |
| 15 |
| 16 | namespace base { |
| 17 | namespace debug { |
| 18 |
| 19 | #if defined(ADDRESS_SANITIZER) || BUILDFLAG(IS_HWASAN) |
| 20 |
| 21 | // Generates an heap buffer overflow. |
| 22 | BASE_EXPORT NOINLINE void AsanHeapOverflow(); |
| 23 |
| 24 | // Generates an heap buffer underflow. |
| 25 | BASE_EXPORT NOINLINE void AsanHeapUnderflow(); |
| 26 |
| 27 | // Generates an use after free. |
| 28 | BASE_EXPORT NOINLINE void AsanHeapUseAfterFree(); |
| 29 |
| 30 | // The "corrupt-block" and "corrupt-heap" classes of bugs is specific to |
| 31 | // Windows. |
| 32 | #if defined(OS_WIN) |
| 33 | // Corrupts a memory block and makes sure that the corruption gets detected when |
| 34 | // we try to free this block. |
| 35 | BASE_EXPORT NOINLINE void AsanCorruptHeapBlock(); |
| 36 |
| 37 | // Corrupts the heap and makes sure that the corruption gets detected when a |
| 38 | // crash occur. |
| 39 | BASE_EXPORT NOINLINE void AsanCorruptHeap(); |
| 40 |
| 41 | #endif // OS_WIN |
| 42 | #endif // ADDRESS_SANITIZER |
| 43 |
| 44 | } // namespace debug |
| 45 | } // namespace base |
| 46 |
| 47 | #endif // BASE_DEBUG_ASAN_INVALID_ACCESS_H_ |
| 48 |