fuzz: purge old sessions (#1451)

At every fuzz iteration (i.e for every trace file):
* keep the same ndpi context (`ndpi_init_detection_module` is very
slow);
* reset the flow table, otherwise it grows indefinitely.

This change should fix the "out-of-memory" errors reported by oss-fuzz.
This commit is contained in:
Ivan Nardi
2022-02-21 20:32:50 +01:00
committed by GitHub
parent 6c1accd2bd
commit fbb9700086
4 changed files with 14 additions and 5 deletions
+1 -1
View File
@@ -2062,7 +2062,7 @@ static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) {
prefs.ignore_vlanid = ignore_vlanid;
memset(&ndpi_thread_info[thread_id], 0, sizeof(ndpi_thread_info[thread_id]));
ndpi_thread_info[thread_id].workflow = ndpi_workflow_init(&prefs, pcap_handle);
ndpi_thread_info[thread_id].workflow = ndpi_workflow_init(&prefs, pcap_handle, 1);
/* Preferences */
ndpi_workflow_set_flow_detected_callback(ndpi_thread_info[thread_id].workflow,