From 35c2ea20f55c09e5e477a0057db95ca307f480d7 Mon Sep 17 00:00:00 2001 From: Wally Zhao Date: Wed, 26 Jul 2023 22:16:09 +0800 Subject: [PATCH] fix potential stat overflow --- h2load_utils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/h2load_utils.cc b/h2load_utils.cc index 7feb473..318335f 100644 --- a/h2load_utils.cc +++ b/h2load_utils.cc @@ -1067,7 +1067,8 @@ void output_realtime_stats(h2load::Config& config, size_t sum = 0; for (auto& one_d_vec : two_d_vec) { - sum += std::accumulate(one_d_vec.begin(), one_d_vec.end(), 0); + size_t init = 0; + sum += std::accumulate(one_d_vec.begin(), one_d_vec.end(), init); } return sum; };