From 6615204f4fd5748777e4f5d8b036795a6151d76e Mon Sep 17 00:00:00 2001 From: Nikolay Antonov Date: Sat, 12 Oct 2024 14:10:17 +0000 Subject: [PATCH] Fix SIGSEGV in S3StorageInteractor.ListPath. When source S3 bucket have been deleted we receive SignatureDoesNotMatch error when trying to list objects in bucket. This error wasn't handled properly, so it lead to nil-reference dereference in next line. (Also, yp-client showed `failed to read params: EOF` to client) --- pkg/proc/interaction.go | 4 ++-- pkg/storage/s3storage.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/proc/interaction.go b/pkg/proc/interaction.go index ab10212..9ff4cac 100644 --- a/pkg/proc/interaction.go +++ b/pkg/proc/interaction.go @@ -121,7 +121,7 @@ func ProcessPutExtended( return } else if n != int(msg.Sz) { - _ = ycl.ReplyError(fmt.Errorf("unfull write"), "failed to compelete request") + _ = ycl.ReplyError(fmt.Errorf("unfull write"), "failed to complete request") return } @@ -177,7 +177,7 @@ func ProcessListExtended(msg message.ListMessage, s storage.StorageInteractor, c objectMetas, err := s.ListPath(msg.Prefix) if err != nil { - _ = ycl.ReplyError(fmt.Errorf("could not list objects: %s", err), "failed to compelete request") + _ = ycl.ReplyError(fmt.Errorf("could not list objects: %s", err), "failed to complete request") return nil } diff --git a/pkg/storage/s3storage.go b/pkg/storage/s3storage.go index c2eae3c..dd8894e 100644 --- a/pkg/storage/s3storage.go +++ b/pkg/storage/s3storage.go @@ -166,6 +166,7 @@ func (s *S3StorageInteractor) ListPath(prefix string) ([]*object.ObjectInfo, err out, err := sess.ListObjectsV2(input) if err != nil { fmt.Printf("list error: %v\n", err) + return nil, err } for _, obj := range out.Contents {