From 1eb90de88befdaccc36dee14898139382fb284e5 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Mon, 13 Dec 2021 19:16:34 +0100 Subject: [PATCH] Fix out of bounds bug in ovnisort --- sort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sort.c b/sort.c index cc8e35e..e9d9811 100644 --- a/sort.c +++ b/sort.c @@ -98,7 +98,7 @@ find_destination(struct ring *r, uint64_t clock) start = r->tail - 1 >= 0 ? r->tail - 1 : r->size - 1; end = r->head - 1 >= 0 ? r->head - 1 : r->size - 1; - for(i=start; i != end; i = i-1 < 0 ? r->size : i-1) + for(i=start; i != end; i = i-1 < 0 ? r->size - 1: i-1) { if(r->ev[i]->header.clock < clock) {