blob: 0183d939af51b8eb3c5f498bc3ea123b34bfe91e [file] [log] [blame]
Vitaly Buka7dbc1d82017-11-01 03:02:59 +00001// 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 Rytarowskie81e9442018-01-12 17:15:05 +000010#include <cstdlib>
Vitaly Buka7dbc1d82017-11-01 03:02:59 +000011#include <thread>
12
13extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
14 auto C = [&] {
Matt Morehouse22a1afd92018-03-27 16:40:20 +000015 void * volatile a = malloc(5639);
Vitaly Buka7dbc1d82017-11-01 03:02:59 +000016 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}