Vitaly Buka | 7dbc1d8 | 2017-11-01 03:02:59 +0000 | [diff] [blame] | 1 | // This file is distributed under the University of Illinois Open Source |
| 2 | // License. See LICENSE.TXT for details. |
| 3 | |
| 4 | // Check that allocation tracing from different threads does not cause |
| 5 | // interleaving of stack traces. |
| 6 | #include <assert.h> |
| 7 | #include <cstddef> |
| 8 | #include <cstdint> |
| 9 | #include <cstring> |
Kamil Rytarowski | e81e944 | 2018-01-12 17:15:05 +0000 | [diff] [blame] | 10 | #include <cstdlib> |
Vitaly Buka | 7dbc1d8 | 2017-11-01 03:02:59 +0000 | [diff] [blame] | 11 | #include <thread> |
| 12 | |
| 13 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { |
| 14 | auto C = [&] { |
Matt Morehouse | 22a1afd9 | 2018-03-27 16:40:20 +0000 | [diff] [blame] | 15 | void * volatile a = malloc(5639); |
Vitaly Buka | 7dbc1d8 | 2017-11-01 03:02:59 +0000 | [diff] [blame] | 16 | free((void *)a); |
| 17 | }; |
| 18 | std::thread T[] = {std::thread(C), std::thread(C), std::thread(C), |
| 19 | std::thread(C), std::thread(C), std::thread(C)}; |
| 20 | for (auto &X : T) |
| 21 | X.join(); |
| 22 | return 0; |
| 23 | } |