From 7366d62e41bb2b676505994ec93be011bff25f43 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 30 Apr 2021 10:41:26 +0300 Subject: [PATCH] [#431] object/range: Fix payload slice allocation in re-sign callback Allocate capacity instead of length of the slice to write the object payload range since each chunk is written through `append`. Signed-off-by: Leonard Lyubich --- pkg/services/object/get/v2/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/services/object/get/v2/util.go b/pkg/services/object/get/v2/util.go index c3f13b0e..badd3836 100644 --- a/pkg/services/object/get/v2/util.go +++ b/pkg/services/object/get/v2/util.go @@ -204,7 +204,7 @@ func (s *Service) toRangePrm(req *objectV2.GetRangeRequest, stream objectSvc.Get return nil, errors.Wrap(err, "could not create Get payload range stream") } - payload := make([]byte, body.GetRange().GetLength()) + payload := make([]byte, 0, body.GetRange().GetLength()) resp := new(objectV2.GetRangeResponse)