diff options
author | koe <ukoe@protonmail.com> | 2021-08-13 06:57:27 -0500 |
---|---|---|
committer | selsta <selsta@sent.at> | 2021-10-14 02:43:57 +0200 |
commit | 945665ff70efc01e93cb4cac15b81e3247be9a32 (patch) | |
tree | c16537064a5b8c16a78325c5d8f516998dad7ac2 /contrib/epee/include | |
parent | LMDB: fix deadlock in resized detection (diff) | |
download | monero-945665ff70efc01e93cb4cac15b81e3247be9a32.tar.xz |
fix median overflow bug
Diffstat (limited to 'contrib/epee/include')
-rw-r--r-- | contrib/epee/include/stats.inl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/epee/include/stats.inl b/contrib/epee/include/stats.inl index 5a5cd0b93..70c127be7 100644 --- a/contrib/epee/include/stats.inl +++ b/contrib/epee/include/stats.inl @@ -1,6 +1,7 @@ #include <math.h> #include <limits> #include <algorithm> +#include "misc_language.h" #include "stats.h" enum @@ -86,7 +87,7 @@ Tpod Stats<T, Tpod>::get_median() const } else { - median = (sorted[(sorted.size() - 1) / 2] + sorted[sorted.size() / 2]) / 2; + median = epee::misc_utils::get_mid(sorted[(sorted.size() - 1) / 2], sorted[sorted.size() / 2]); } set_cached(bit_median); } |