[Tarantool-patches] [PATCH 03/11] vclock: vclock_inc -- add assert() to catch overflow
Cyrill Gorcunov
gorcunov at gmail.com
Thu Nov 12 22:51:13 MSK 2020
To make sure we won't access out of bounds in lsn array.
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
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;
--
2.26.2
More information about the Tarantool-patches
mailing list