about summary refs log tree commit diff
path: root/examples/aflpp_driver/aflpp_driver_test.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-09-04 22:48:46 +0200
committerGitHub <noreply@github.com>2020-09-04 22:48:46 +0200
commit4f7a8a4c70de1b93b1dccd8f2bf092ec4b3626dc (patch)
tree8c81a16ba76661b0df5307b9964275ff529d4deb /examples/aflpp_driver/aflpp_driver_test.c
parent7f621509eee57f0b6fd9ad542adc4f2acafeb059 (diff)
parent976ee9022cda95e0715b82ff866098ad293117c9 (diff)
downloadafl++-4f7a8a4c70de1b93b1dccd8f2bf092ec4b3626dc.tar.gz
Merge pull request #542 from AFLplusplus/dev
push to stable
Diffstat (limited to 'examples/aflpp_driver/aflpp_driver_test.c')
-rw-r--r--examples/aflpp_driver/aflpp_driver_test.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/aflpp_driver/aflpp_driver_test.c b/examples/aflpp_driver/aflpp_driver_test.c
index ddc3effb..b4ff6bc6 100644
--- a/examples/aflpp_driver/aflpp_driver_test.c
+++ b/examples/aflpp_driver/aflpp_driver_test.c
@@ -6,6 +6,8 @@
 
 void __attribute__((noinline)) crashme(const uint8_t *Data, size_t Size) {
 
+  if (Size < 5) return;
+
   if (Data[0] == 'F')
     if (Data[1] == 'A')
       if (Data[2] == '$')
@@ -16,12 +18,11 @@ void __attribute__((noinline)) crashme(const uint8_t *Data, size_t Size) {
 
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
 
-  fprintf(stderr, "FUNC crc: %016llx len: %lu\n",
-          hash64((u8 *)Data, (unsigned int)Size,
-                 (unsigned long long int)0xa5b35705),
-          Size);
-
-  if (Size < 5) return 0;
+  if (Size)
+    fprintf(stderr, "FUNC crc: %016llx len: %lu\n",
+            hash64((u8 *)Data, (unsigned int)Size,
+                   (unsigned long long int)0xa5b35705),
+            Size);
 
   crashme(Data, Size);