]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
fuzz: target for applayer cleans transactions
authorPhilippe Antoine <contact@catenacyber.fr>
Thu, 17 Jun 2021 13:02:30 +0000 (15:02 +0200)
committerVictor Julien <vjulien@oisf.net>
Tue, 1 Feb 2022 06:17:38 +0000 (07:17 +0100)
Ticket: 4530

Otherwise, we timeout because we kept too many of them
as Suricata would not

src/tests/fuzz/fuzz_applayerparserparse.c

index bc8efea806d212f97c9a5e78bf9b968047dc51cf..945cb32c35a09719a942992529ca240f10f51c31 100644 (file)
@@ -117,6 +117,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
         f->alproto = data[0];
     }
 
+    FLOWLOCK_WRLOCK(f);
     /*
      * We want to fuzz multiple calls to AppLayerParserParse
      * because some parts of the code are only reached after
@@ -163,6 +164,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
                 alsize = 0;
                 break;
             }
+
+            AppLayerParserTransactionsCleanup(f);
         }
         alsize -= alnext - albuffer + 4;
         albuffer = alnext + 4;
@@ -191,6 +194,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
         free(isolatedBuffer);
     }
 
+    FLOWLOCK_UNLOCK(f);
     FlowFree(f);
 
     return 0;