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
This commit is contained in:
Ivan Nardi
2023-07-11 10:12:08 +02:00
committed by GitHub
parent 859d9ea3c3
commit 950f5cc4e3
18 changed files with 208 additions and 55 deletions
+8 -2
View File
@@ -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);