diff options
| author | Tatsuya Kinoshita <tats@debian.org> | 2021-03-06 22:03:29 +0000 | 
|---|---|---|
| committer | Tatsuya Kinoshita <tats@debian.org> | 2021-03-06 22:03:29 +0000 | 
| commit | 0b3effab72f5434b3bcb13fbc6b4ccdf784428d2 (patch) | |
| tree | a2a3a9f8c98074505faafee5d58b7c9ab5f6484c /fuzz | |
| parent | Update ChangeLog (diff) | |
| download | w3m-0b3effab72f5434b3bcb13fbc6b4ccdf784428d2.tar.gz w3m-0b3effab72f5434b3bcb13fbc6b4ccdf784428d2.zip | |
Set GC_oom_fn in fuzzing
Diffstat (limited to 'fuzz')
| -rw-r--r-- | fuzz/fuzz-conv.c | 10 | 
1 files changed, 10 insertions, 0 deletions
| diff --git a/fuzz/fuzz-conv.c b/fuzz/fuzz-conv.c index b067378..3e85f86 100644 --- a/fuzz/fuzz-conv.c +++ b/fuzz/fuzz-conv.c @@ -14,11 +14,21 @@ char *get_null_terminated(const uint8_t *data, size_t size) {      return new_str;  } +static void *die_oom(size_t bytes) { +    fprintf(stderr, "Out of memory: %lu bytes unavailable!\n", (unsigned long)bytes); +    exit(1); +} +  int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size){      static int init_done = 0;      if (!init_done) {  	GC_INIT(); +#if (GC_VERSION_MAJOR>7) || ((GC_VERSION_MAJOR==7) && (GC_VERSION_MINOR>=2)) +	GC_set_oom_fn(die_oom); +#else +	GC_oom_fn = die_oom; +#endif  	init_done = 1;      } | 
