Skip to content

Commit

Permalink
fstree: return an error is combined file has incorrect prefix
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
roman-khimov committed Nov 26, 2024
1 parent dfa8068 commit 538c150
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/local_object_storage/blobstor/fstree/fstree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Check warning on line 400 in pkg/local_object_storage/blobstor/fstree/fstree.go

View check run for this annotation

Codecov / codecov/patch

pkg/local_object_storage/blobstor/fstree/fstree.go#L398-L400

Added lines #L398 - L400 were not covered by tests
st, err := f.Stat()
if err != nil {
return nil, err
Expand Down

0 comments on commit 538c150

Please sign in to comment.