aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorkoe <ukoe@protonmail.com>2021-08-13 06:57:27 -0500
committerkoe <ukoe@protonmail.com>2021-08-13 06:57:27 -0500
commit426dbf434b54f4ef4c40b1887bb13194c2caacbf (patch)
treee0ac181ccda176c87a1c43290afe3ac5b645cdc9 /contrib
parentMerge pull request #7818 (diff)
downloadmonero-426dbf434b54f4ef4c40b1887bb13194c2caacbf.tar.xz
fix median overflow bug
Diffstat (limited to 'contrib')
-rw-r--r--contrib/epee/include/stats.inl3
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);
}