1 
2 #include <stddef.h>
3 #include <stdint.h>
4 #include <string.h>
5 #include <iostream>
6 
7 #include <string>
8 
CrashFunc(const char * data)9 void CrashFunc(const char *data) {
10 
11   if (strcmp(data, "c") == 0) {
12     volatile int* arr = new int[10];
13     for (int i = 0; i < 15; i++){
14         arr[i] = 54;
15     }
16   }
17 }
18 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)19 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
20   std::string null_terminated_string(reinterpret_cast<const char *>(data),
21                                      size);
22 
23   CrashFunc(null_terminated_string.c_str());
24   return 0;
25 }
26