From f7ae9ad7861c6fb3442b9daebb10f0ac73b23608 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Tue, 12 Nov 2024 14:33:38 +0800 Subject: [PATCH] validate timestamp --- versiondb/tsrocksdb/store.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/versiondb/tsrocksdb/store.go b/versiondb/tsrocksdb/store.go index 86a3f33e4f..109a452f4e 100644 --- a/versiondb/tsrocksdb/store.go +++ b/versiondb/tsrocksdb/store.go @@ -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) }