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> 10 #include <cstdlib> 11 #include <thread> 12 13 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 14 auto C = [&] { 15 volatile void *a = malloc(5639); 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 } 24