From 950f5cc4e3ddd9bc0f8881950082283aa381c805 Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:12:08 +0200 Subject: fuzz: extend fuzzing coverage (#2040) Some notes: * libinjection: according to https://github.com/libinjection/libinjection/issues/44, it seems NULL characters are valid in the input string; * RTP: `rtp_get_stream_type()` is called only for RTP packets; if you want to tell RTP from RTCP you should use `is_rtp_or_rtcp()`; * TLS: unnecessary check; we already make the same check just above, at the beginning of the `while` loop --- fuzz/fuzz_alg_hw_rsi_outliers_da.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'fuzz/fuzz_alg_hw_rsi_outliers_da.cpp') diff --git a/fuzz/fuzz_alg_hw_rsi_outliers_da.cpp b/fuzz/fuzz_alg_hw_rsi_outliers_da.cpp index 3ea9551e4..6e4f2af17 100644 --- a/fuzz/fuzz_alg_hw_rsi_outliers_da.cpp +++ b/fuzz/fuzz_alg_hw_rsi_outliers_da.cpp @@ -16,10 +16,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { u_int8_t additive_seeasonal; double alpha, beta, gamma, forecast, confidence_band; float significance; - u_int32_t *values; + u_int32_t *values, predict_periods; + u_int32_t prediction; bool *outliers; - /* Use the same (integral) dataset to peform: RSI, Data analysis, HW and outliers */ + /* Use the same (integral) dataset to peform: RSI, Data analysis, HW, outliers + and linear regression */ /* Just to have some data */ if(fuzzed_data.remaining_bytes() < 1024) @@ -57,6 +59,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { max_series_len = fuzzed_data.ConsumeIntegral(); a = ndpi_alloc_data_analysis(max_series_len); + /* Init Linear Regression */ + predict_periods = fuzzed_data.ConsumeIntegral(); + /* Calculate! */ for (i = 0; i < num_values; i++) { if (rc_hw == 0) @@ -66,6 +71,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ndpi_data_add_value(a, values[i]); } ndpi_find_outliers(values, outliers, num_values); + ndpi_predict_linear(values, num_values, predict_periods, &prediction); /* Data analysis stuff */ ndpi_data_average(a); -- cgit v1.2.3