From f8ee322b08dcca42c36d95a7e2e47f919a0aa16c Mon Sep 17 00:00:00 2001 From: siddontang Date: Thu, 11 Aug 2016 09:24:49 +0800 Subject: [PATCH] raft: fix overflow --- raft/log.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raft/log.go b/raft/log.go index 83dcb662c..e626385d5 100644 --- a/raft/log.go +++ b/raft/log.go @@ -339,7 +339,7 @@ func (l *raftLog) mustCheckOutOfBounds(lo, hi uint64) error { return ErrCompacted } - length := l.lastIndex() - fi + 1 + length := l.lastIndex() + 1 - fi if lo < fi || hi > fi+length { l.logger.Panicf("slice[%d,%d) out of bound [%d,%d]", lo, hi, fi, l.lastIndex()) }