Skip to content

Commit

Permalink
storage: fix CheckSSTConflicts access of undefined buffer
Browse files Browse the repository at this point in the history
This is a backport of the CheckSSTConflicts bug fix contained within cockroachdb#96685.
Previously, CheckSSTConflicts would improperly access an invalid iterator's
`UnsafeKey`, using it to seek another iterator.

Epic: None
Release note: None
  • Loading branch information
jbowens committed Feb 10, 2023
1 parent df15537 commit 062da00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/storage/sst.go
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ func CheckSSTConflicts(
// 2) the ext iterator became invalid
// 3) both iterators changed keys and the sst iterator's key is further
// ahead.
if extChangedKeys && (!sstChangedKeys || (!extOK && sstOK) || extIter.UnsafeKey().Key.Compare(sstIter.UnsafeKey().Key) < 0) {
if sstOK && extChangedKeys && (!sstChangedKeys || !extOK || extIter.UnsafeKey().Key.Compare(sstIter.UnsafeKey().Key) < 0) {
extIter.SeekGE(MVCCKey{Key: sstIter.UnsafeKey().Key})
extOK, extErr = extIter.Valid()
}
Expand Down

0 comments on commit 062da00

Please sign in to comment.