mirror of
https://github.com/janet-lang/janet
synced 2026-10-17 13:02:26 +00:00
28 lines
623 B
C
28 lines
623 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 binary unmarshal (deserialization) path in src/core/marsh.c */
|
|
JanetTable *reg = janet_env_lookup(janet_core_env(NULL));
|
|
JanetTryState tstate;
|
|
if (janet_try(&tstate) == JANET_SIGNAL_OK) {
|
|
const uint8_t *next = NULL;
|
|
janet_unmarshal(data, size, 0, reg, &next);
|
|
}
|
|
janet_restore(&tstate);
|
|
|
|
/* cleanup Janet */
|
|
janet_deinit();
|
|
|
|
return 0;
|
|
}
|