From 538c1500af64f1e8cf1de4a2a3c54bac3460931c Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 26 Nov 2024 18:27:51 +0300 Subject: [PATCH] fstree: return an error is combined file has incorrect prefix When we already know that the file is combined (seen the prefix at least once, isCombined is true) we expect all subsequent entries to be proper combined ones as well. If they're not (wrong prefix) --- something is wrong with the file and returning it as is won't help. Signed-off-by: Roman Khimov --- pkg/local_object_storage/blobstor/fstree/fstree.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/local_object_storage/blobstor/fstree/fstree.go b/pkg/local_object_storage/blobstor/fstree/fstree.go index 4ae66cc9ae..65a0cd1a85 100644 --- a/pkg/local_object_storage/blobstor/fstree/fstree.go +++ b/pkg/local_object_storage/blobstor/fstree/fstree.go @@ -395,6 +395,9 @@ func extractCombinedObject(id oid.ID, f *os.File) ([]byte, error) { } thisOID, l := parseCombinedPrefix(comBuf) if thisOID == nil { + if isCombined { + return nil, errors.New("malformed combined file") + } st, err := f.Stat() if err != nil { return nil, err