mirror of
https://github.com/monero-project/monero.git
synced 2025-05-06 10:05:03 -04:00
Fix overflow issue in epee:misc_utils::rolling_median_t and median(), with unit test
This commit is contained in:
parent
5d850dde99
commit
85efc88c1e
3 changed files with 23 additions and 2 deletions
|
@ -34,6 +34,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "misc_language.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -226,7 +228,7 @@ public:
|
|||
Item v = data[heap[0]];
|
||||
if (minCt < maxCt)
|
||||
{
|
||||
v = (v + data[heap[-1]]) / 2;
|
||||
v = get_mid<Item>(v, data[heap[-1]]);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue