aboutsummaryrefslogtreecommitdiff
path: root/fuzz/fuzz_alg_hw_rsi_outliers_da.cpp
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2023-07-11 10:12:08 +0200
committerGitHub <noreply@github.com>2023-07-11 10:12:08 +0200
commit950f5cc4e3ddd9bc0f8881950082283aa381c805 (patch)
tree4686d9c1b1d0348d06db9d6aa8ed166f449e3238 /fuzz/fuzz_alg_hw_rsi_outliers_da.cpp
parent859d9ea3c33c3ed54c159658a94381fdd4e7eccb (diff)
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
Diffstat (limited to 'fuzz/fuzz_alg_hw_rsi_outliers_da.cpp')
-rw-r--r--fuzz/fuzz_alg_hw_rsi_outliers_da.cpp10
1 files changed, 8 insertions, 2 deletions
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<u_int16_t>();
a = ndpi_alloc_data_analysis(max_series_len);
+ /* Init Linear Regression */
+ predict_periods = fuzzed_data.ConsumeIntegral<u_int8_t>();
+
/* 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);