about summary refs log tree commit diff
path: root/src/afl-performance.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2024-07-01 08:57:38 +0200
committerGitHub <noreply@github.com>2024-07-01 08:57:38 +0200
commit53409530b369e560c7f6f37ead5a5db9e116efd0 (patch)
tree6449fa84e6b9e26849d298af881014b18f55dc0b /src/afl-performance.c
parent36db3428ab16156dd72196213d2a02a5eadaed11 (diff)
parent43014cd465eec8cc47eda041802001776dbb5dd5 (diff)
downloadafl++-53409530b369e560c7f6f37ead5a5db9e116efd0.tar.gz
Merge pull request #2141 from AFLplusplus/dev
push to stable
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);