diff --git a/raft/log.go b/raft/log.go index c94c41f77..82cf54aa2 100644 --- a/raft/log.go +++ b/raft/log.go @@ -95,6 +95,9 @@ func (l *raftLog) maybeAppend(index, logTerm, committed uint64, ents ...pb.Entry l.logger.Panicf("entry %d conflict with committed entry [committed(%d)]", ci, l.committed) default: offset := index + 1 + if ci-offset > uint64(len(ents)) { + l.logger.Panicf("index, %d, is out of range [%d]", ci-offset, len(ents)) + } l.append(ents[ci-offset:]...) } l.commitTo(min(committed, lastnewi))