From 40b6d5a2e193322e6e93b2eeb087c51d8eb6faad Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Tue, 25 Apr 2023 16:37:28 +0200 Subject: fuzz: extend fuzzers coverage (#1952) --- src/lib/ndpi_analyze.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lib/ndpi_analyze.c') diff --git a/src/lib/ndpi_analyze.c b/src/lib/ndpi_analyze.c index 178097b9f..346e65a48 100644 --- a/src/lib/ndpi_analyze.c +++ b/src/lib/ndpi_analyze.c @@ -1096,6 +1096,7 @@ int ndpi_hw_init(struct ndpi_hw_struct *hw, if((hw->s = (double*)ndpi_calloc(hw->params.num_season_periods, sizeof(double))) == NULL) { ndpi_free(hw->y); + hw->y = NULL; return(-1); } @@ -1213,8 +1214,10 @@ void ndpi_hw_reset(struct ndpi_hw_struct *hw) { hw->num_values = 0; hw->u = hw->v = hw->sum_square_error = 0; - memset(&hw->y, 0, (hw->params.num_season_periods * sizeof(u_int64_t))); - memset(&hw->s, 0, (hw->params.num_season_periods * sizeof(double))); + if(hw->y) + memset(hw->y, 0, (hw->params.num_season_periods * sizeof(u_int64_t))); + if(hw->s) + memset(hw->s, 0, (hw->params.num_season_periods * sizeof(double))); } /* ********************************************************************************* */ -- cgit v1.2.3