From 871be9d63d1e227ab436aaca4939fef1ddf6d59b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 8 Nov 2022 11:23:56 +0300 Subject: [PATCH] [#2024] services/object: Cover corner cases for children OutOfRange Signed-off-by: Evgenii Stratonikov --- pkg/services/object/get/assemble.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/services/object/get/assemble.go b/pkg/services/object/get/assemble.go index 08d8806c3..596a0bdb1 100644 --- a/pkg/services/object/get/assemble.go +++ b/pkg/services/object/get/assemble.go @@ -88,11 +88,12 @@ func (exec *execCtx) initFromChild(obj oid.ID) (prev *oid.ID, children []oid.ID) var payload []byte if rng := exec.ctxRange(); rng != nil { - seekLen := rng.GetLength() seekOff := rng.GetOffset() + seekLen := rng.GetLength() + seekTo := seekOff + seekLen parSize := par.PayloadSize() - if seekOff+seekLen > parSize { + if seekTo < seekOff || parSize < seekOff || parSize < seekTo { var errOutOfRange apistatus.ObjectOutOfRange exec.err = errOutOfRange