From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp53.i.mail.ru (smtp53.i.mail.ru [94.100.177.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 6920D469719 for ; Fri, 13 Nov 2020 12:30:56 +0300 (MSK) References: <20201112195121.191366-1-gorcunov@gmail.com> <20201112195121.191366-4-gorcunov@gmail.com> From: Serge Petrenko Message-ID: <417a48b6-2c60-18d5-c649-00c5d4206153@tarantool.org> Date: Fri, 13 Nov 2020 12:30:53 +0300 MIME-Version: 1.0 In-Reply-To: <20201112195121.191366-4-gorcunov@gmail.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: ru Subject: Re: [Tarantool-patches] [PATCH 03/11] vclock: vclock_inc -- add assert() to catch overflow List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov , tml Cc: Vladislav Shpilevoy 12.11.2020 22:51, Cyrill Gorcunov пишет: > To make sure we won't access out of bounds in lsn array. > > Signed-off-by: Cyrill Gorcunov > --- > src/lib/vclock/vclock.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/src/lib/vclock/vclock.h b/src/lib/vclock/vclock.h > index fd4072c94..09521a393 100644 > --- a/src/lib/vclock/vclock.h > +++ b/src/lib/vclock/vclock.h > @@ -169,6 +169,7 @@ vclock_get(const struct vclock *vclock, uint32_t replica_id) > static inline int64_t > vclock_inc(struct vclock *vclock, uint32_t replica_id) > { > + assert(replica_id < VCLOCK_MAX); > /* Easier add each time than check. */ > if (((vclock->map >> replica_id) & 0x01) == 0) { > vclock->lsn[replica_id] = 0; LGTM -- Serge Petrenko