From 6ca1304bd4cf5b554f4775331738458470e7954f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Wed, 14 Jun 2017 09:07:54 +0200 Subject: [PATCH] Fix libpsl_load_dafsa_fuzzer for libc6 < 2.22 --- fuzz/libpsl_load_dafsa_fuzzer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fuzz/libpsl_load_dafsa_fuzzer.c b/fuzz/libpsl_load_dafsa_fuzzer.c index ee6cce6..334103c 100644 --- a/fuzz/libpsl_load_dafsa_fuzzer.c +++ b/fuzz/libpsl_load_dafsa_fuzzer.c @@ -59,11 +59,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) // non-DAFSA load fp = fmemopen(in + 16, size, "r"); - assert(fp != NULL); + if (!fp && size) // libc6 < 2.22 return NULL when size == 0 + assert(1); psl = psl_load_fp(fp); psl_free(psl); - fclose(fp); + if (fp) + fclose(fp); psl = psl_latest(NULL); psl_free(psl);