about summary refs log tree commit diff
path: root/src/afl-performance.c
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2024-06-10 18:22:06 +0200
committervanhauser-thc <vh@thc.org>2024-06-10 18:22:06 +0200
commit6ed0a2b4aa0c22f95ba723cfda5b1fb79a224bc8 (patch)
tree9e91158d6301667ca76dc162ddb2a99ab08fb246 /src/afl-performance.c
parent8e50c0c103cade9723f115fc92e3065f64c79713 (diff)
downloadafl++-6ed0a2b4aa0c22f95ba723cfda5b1fb79a224bc8.tar.gz
fast resume setup detection
Diffstat (limited to 'src/afl-performance.c')
-rw-r--r--src/afl-performance.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/afl-performance.c b/src/afl-performance.c
index e8ece6b5..b824fd35 100644
--- a/src/afl-performance.c
+++ b/src/afl-performance.c
@@ -99,11 +99,13 @@ inline u64 hash64(u8 *key, u32 len, u64 seed) {
 
 u64 get_binary_hash(u8 *fn) {
 
+  if (!fn) { return 0; }
   int fd = open(fn, O_RDONLY);
   if (fd < 0) { PFATAL("Unable to open '%s'", fn); }
   struct stat st;
   if (fstat(fd, &st) < 0) { PFATAL("Unable to fstat '%s'", fn); }
   u32 f_len = st.st_size;
+  if (!f_len) { return 0; }
   u8 *f_data = mmap(0, f_len, PROT_READ, MAP_PRIVATE, fd, 0);
   if (f_data == MAP_FAILED) { PFATAL("Unable to mmap file '%s'", fn); }
   close(fd);