fix_read_tomb_needle_meta (#4263)

Co-authored-by: zemul <zhouzemiao@ihuman.com>
This commit is contained in:
zemul 2023-03-03 00:26:55 +08:00 committed by GitHub
parent 0bf56298d5
commit bd6f2716d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,8 +66,12 @@ func (n *Needle) ReadNeedleMeta(r backend.BackendStorageFile, offset int64, size
if err != nil {
return err
}
var index int
index, err = n.readNeedleDataVersion2NonData(metaSlice)
if size.IsValid() {
index, err = n.readNeedleDataVersion2NonData(metaSlice)
}
n.Checksum = CRC(util.BytesToUint32(metaSlice[index : index+NeedleChecksumSize]))
if version == Version3 {
n.AppendAtNs = util.BytesToUint64(metaSlice[index+NeedleChecksumSize : index+NeedleChecksumSize+TimestampSize])