raft: fix overflow

This commit is contained in:
siddontang 2016-08-11 09:24:49 +08:00
parent 8a32929d29
commit f8ee322b08

View File

@ -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())
}