| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Defines some functions that intentionally do an invalid memory access in | 5 // Defines some functions that intentionally do an invalid memory access in |
| 6 // order to trigger an AddressSanitizer (ASan) error report. | 6 // order to trigger an AddressSanitizer (ASan) error report. |
| 7 | 7 |
| 8 #ifndef BASE_DEBUG_ASAN_INVALID_ACCESS_H_ | 8 #ifndef BASE_DEBUG_ASAN_INVALID_ACCESS_H_ |
| 9 #define BASE_DEBUG_ASAN_INVALID_ACCESS_H_ | 9 #define BASE_DEBUG_ASAN_INVALID_ACCESS_H_ |
| 10 | 10 |
| 11 #include "base/base_export.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 namespace debug { | 15 namespace debug { |
| 15 | 16 |
| 16 #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN) | 17 #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN) |
| 17 | 18 |
| 18 // Generates an heap buffer overflow. | 19 // Generates an heap buffer overflow. |
| 19 NOINLINE void AsanHeapOverflow(); | 20 BASE_EXPORT NOINLINE void AsanHeapOverflow(); |
| 20 | 21 |
| 21 // Generates an heap buffer underflow. | 22 // Generates an heap buffer underflow. |
| 22 NOINLINE void AsanHeapUnderflow(); | 23 BASE_EXPORT NOINLINE void AsanHeapUnderflow(); |
| 23 | 24 |
| 24 // Generates an use after free. | 25 // Generates an use after free. |
| 25 NOINLINE void AsanHeapUseAfterFree(); | 26 BASE_EXPORT NOINLINE void AsanHeapUseAfterFree(); |
| 26 | 27 |
| 27 #endif // ADDRESS_SANITIZER || SYZYASAN | 28 #endif // ADDRESS_SANITIZER || SYZYASAN |
| 28 | 29 |
| 29 // The "corrupt-block" and "corrupt-heap" classes of bugs is specific to | 30 // The "corrupt-block" and "corrupt-heap" classes of bugs is specific to |
| 30 // SyzyASan. | 31 // SyzyASan. |
| 31 #if defined(SYZYASAN) | 32 #if defined(SYZYASAN) |
| 32 | 33 |
| 33 // Corrupts a memory block and makes sure that the corruption gets detected when | 34 // Corrupts a memory block and makes sure that the corruption gets detected when |
| 34 // we try to free this block. | 35 // we try to free this block. |
| 35 NOINLINE void AsanCorruptHeapBlock(); | 36 BASE_EXPORT NOINLINE void AsanCorruptHeapBlock(); |
| 36 | 37 |
| 37 // Corrupts the heap and makes sure that the corruption gets detected when a | 38 // Corrupts the heap and makes sure that the corruption gets detected when a |
| 38 // crash occur. | 39 // crash occur. |
| 39 NOINLINE void AsanCorruptHeap(); | 40 BASE_EXPORT NOINLINE void AsanCorruptHeap(); |
| 40 | 41 |
| 41 #endif // SYZYASAN | 42 #endif // SYZYASAN |
| 42 | 43 |
| 43 } // namespace debug | 44 } // namespace debug |
| 44 } // namespace base | 45 } // namespace base |
| 45 | 46 |
| 46 #endif // BASE_DEBUG_ASAN_INVALID_ACCESS_H_ | 47 #endif // BASE_DEBUG_ASAN_INVALID_ACCESS_H_ |
| OLD | NEW |