mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-30 11:36:54 +00:00
dht: Make i_partitioner::tri_compare memory safe
This patch fixes a typo in i_partitioner::tri_compare() where we were using std::max instead of std::min, thus avoiding accessing random memory and getting random results. Signed-off-by: Duarte Nunes <duarte@scylladb.com> Message-Id: <20161211165043.17816-1-duarte@scylladb.com>
This commit is contained in:
@@ -113,7 +113,7 @@ static inline unsigned char get_byte(bytes_view b, size_t off) {
|
||||
}
|
||||
|
||||
int i_partitioner::tri_compare(const token& t1, const token& t2) const {
|
||||
size_t sz = std::max(t1._data.size(), t2._data.size());
|
||||
size_t sz = std::min(t1._data.size(), t2._data.size());
|
||||
|
||||
for (size_t i = 0; i < sz; i++) {
|
||||
auto b1 = get_byte(t1._data, i);
|
||||
|
||||
Reference in New Issue
Block a user