Skip to content

Commit 24b2319

Browse files
alexlarssoncgwalters
authored andcommitted
ostree: Don't support sparse files in ostree commit
These were potentially allocating a large amount of memory, which is a OOM vector. But sparse files are not really used in practice, they are just a backwards compat hack from the C implementation. Just error out if we find any. Signed-off-by: Alexander Larsson <alexl@redhat.com>
1 parent ff7d17a commit 24b2319

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

crates/composefs-ostree/src/commit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ impl<ObjectID: FsVerityHashValue> CommitWriter<ObjectID> {
331331
LeafContent::Regular(
332332
RegularFile::External(obj_id, _) | RegularFile::ExternalNoVerity(obj_id, _),
333333
) => Some(repo.read_object(obj_id)?),
334-
LeafContent::Regular(RegularFile::Sparse(size)) => {
335-
Some(vec![0u8; *size as usize])
334+
LeafContent::Regular(RegularFile::Sparse(_)) => {
335+
bail!("Sparse files not supported in ostree commit")
336336
}
337337
_ => None,
338338
};

0 commit comments

Comments
 (0)