Skip to content

Commit

Permalink
validate timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Nov 12, 2024
1 parent d831cf1 commit f7ae9ad
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions versiondb/tsrocksdb/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,12 @@ func (s Store) loadWrongData(storeName string) ([]KVPairWithTS, error) {

var pairs []KVPairWithTS
for ; iter.Valid(); iter.Next() {
ts := iter.Timestamp()
key := iter.Key()
if binary.LittleEndian.Uint64(ts) != 0 {
return nil, fmt.Errorf("invalid timestamp: %X, store: %s, key: %X", ts, storeName, key)
}

if len(key) < TimestampSize {
return nil, fmt.Errorf("invalid key length: %X, store: %s", key, storeName)
}
Expand Down

0 comments on commit f7ae9ad

Please sign in to comment.