From 69916f46376bcb9c3d3e57b03a296bac7a6d91f8 Mon Sep 17 00:00:00 2001 From: James Willis <james.s.willis@durham.ac.uk> Date: Tue, 12 Sep 2017 14:28:56 +0100 Subject: [PATCH] Fixed bug that may cause an overflow in sort_j[]. --- src/runner_doiact_vec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runner_doiact_vec.c b/src/runner_doiact_vec.c index f73b1232ad..b4969805fd 100644 --- a/src/runner_doiact_vec.c +++ b/src/runner_doiact_vec.c @@ -290,7 +290,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache( const float first_di = sort_i[first_pi].d + pi->h * kernel_gamma + dx_max - rshift; /* Loop through particles in cell j until they are not in range of pi. */ - while (temp <= cj->count && first_di > sort_j[temp].d) + while (temp < cj->count && first_di > sort_j[temp].d) temp++; max_index_i[first_pi] = temp; @@ -302,7 +302,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache( const float di = sort_i[i].d + pi->h * kernel_gamma + dx_max - rshift; - while (temp <= cj->count && di > sort_j[temp].d) + while (temp < cj->count && di > sort_j[temp].d) temp++; max_index_i[i] = temp; -- GitLab