mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
skip reading needle if size is invalid
related to https://github.com/seaweedfs/seaweedfs/issues/3882
This commit is contained in:
parent
5294b6dd4d
commit
e3ea544d40
|
@ -24,6 +24,7 @@ const (
|
|||
)
|
||||
|
||||
var ErrorSizeMismatch = errors.New("size mismatch")
|
||||
var ErrorSizeInvalid = errors.New("size invalid")
|
||||
|
||||
func (n *Needle) DiskSize(version Version) int64 {
|
||||
return GetActualSize(n.Size, version)
|
||||
|
|
|
@ -43,6 +43,9 @@ func (n *Needle) ReadNeedleMeta(r backend.BackendStorageFile, offset int64, size
|
|||
return ErrorSizeMismatch
|
||||
}
|
||||
}
|
||||
if !n.Size.IsValid() {
|
||||
return ErrorSizeInvalid
|
||||
}
|
||||
n.DataSize = util.BytesToUint32(bytes[NeedleHeaderSize : NeedleHeaderSize+DataSizeSize])
|
||||
|
||||
startOffset := offset + NeedleHeaderSize + DataSizeSize + int64(n.DataSize)
|
||||
|
|
Loading…
Reference in a new issue