2020-04-13 16:33:58 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <janet.h>
|
|
|
|
|
2020-04-17 18:39:23 +00:00
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|
|
|
char *new_str = (char *)malloc(size + 1);
|
|
|
|
if (new_str == NULL) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
memcpy(new_str, data, size);
|
|
|
|
new_str[size] = '\0';
|
2020-04-13 16:33:58 +00:00
|
|
|
|
2020-04-17 18:39:23 +00:00
|
|
|
/* janet logic */
|
|
|
|
janet_init();
|
|
|
|
JanetTable *env = janet_core_env(NULL);
|
|
|
|
janet_dostring(env, new_str, "main", NULL);
|
|
|
|
janet_deinit();
|
2020-04-13 16:33:58 +00:00
|
|
|
|
2020-04-17 18:39:23 +00:00
|
|
|
free(new_str);
|
|
|
|
return 0;
|
2020-04-13 16:33:58 +00:00
|
|
|
}
|
|
|
|
|