From 65dbded9c4274a2367df14be33bf908d9e468cc9 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Tue, 8 Mar 2022 22:31:34 +0100 Subject: [PATCH] Fixed out of bounds access in astrobwt/v2 --- src/crypto/astrobwt/sort_indices2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/astrobwt/sort_indices2.cpp b/src/crypto/astrobwt/sort_indices2.cpp index 60603b84b..2d86d4624 100644 --- a/src/crypto/astrobwt/sort_indices2.cpp +++ b/src/crypto/astrobwt/sort_indices2.cpp @@ -183,7 +183,7 @@ static NOINLINE void sort_indices(uint32_t N, const uint8_t* RESTRICT v, uint32_ uint16_t* a = (uint16_t*)indices; uint16_t* b = (uint16_t*)indices; - uint16_t* e = (uint16_t*)(indices + (N - (unroll - 1))); + uint16_t* e = ((uint16_t*)indices) + (N - (unroll - 1)); for (; a < e; a += unroll, b += unroll * 2) { ITER(0); ITER(1); ITER(2); ITER(3); ITER(4); ITER(5); ITER(6); ITER(7); @@ -192,7 +192,7 @@ static NOINLINE void sort_indices(uint32_t N, const uint8_t* RESTRICT v, uint32_ ITER(24); ITER(25); ITER(26); ITER(27); ITER(28); ITER(29); ITER(30); ITER(31); } - e = (uint16_t*)(indices + N); + e = ((uint16_t*)indices) + N; for (; a < e; ++a, b += 2) { ITER(0); }