mirror of
https://github.com/janet-lang/janet
synced 2026-10-24 00:12:27 +00:00
We were incorrectly handling bad arguments to create a new thread resulting in corruption.
28 lines
631 B
C
28 lines
631 B
C
#include <stdint.h>
|
|
#include <janet.h>
|
|
|
|
/* Disable leak sanitizer */
|
|
int __lsan_is_turned_off(void) {
|
|
return 1;
|
|
}
|
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|
|
|
/* init Janet */
|
|
janet_init();
|
|
|
|
/* fuzz the compile + bytecode VM path (parse, compile, run) in src/core/compile.c and src/core/vm.c */
|
|
JanetTable *env = janet_core_env(NULL);
|
|
JanetTryState tstate;
|
|
if (janet_try(&tstate) == JANET_SIGNAL_OK) {
|
|
Janet out;
|
|
janet_dobytes(env, data, (int32_t) size, "<fuzz>", &out);
|
|
}
|
|
janet_restore(&tstate);
|
|
|
|
/* cleanup Janet */
|
|
janet_deinit();
|
|
|
|
return 0;
|
|
}
|