[#2024] services/object: Cover corner cases for children OutOfRange

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-11-08 11:23:56 +03:00 committed by fyrchik
parent 3eb2ac985d
commit 871be9d63d

View file

@ -88,11 +88,12 @@ func (exec *execCtx) initFromChild(obj oid.ID) (prev *oid.ID, children []oid.ID)
var payload []byte var payload []byte
if rng := exec.ctxRange(); rng != nil { if rng := exec.ctxRange(); rng != nil {
seekLen := rng.GetLength()
seekOff := rng.GetOffset() seekOff := rng.GetOffset()
seekLen := rng.GetLength()
seekTo := seekOff + seekLen
parSize := par.PayloadSize() parSize := par.PayloadSize()
if seekOff+seekLen > parSize { if seekTo < seekOff || parSize < seekOff || parSize < seekTo {
var errOutOfRange apistatus.ObjectOutOfRange var errOutOfRange apistatus.ObjectOutOfRange
exec.err = errOutOfRange exec.err = errOutOfRange