From 043597604352145170809595007be010d4140ec3 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 3 Jul 2026 14:10:38 +0200 Subject: [PATCH] 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 --- crates/composefs-ostree/src/commit.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/composefs-ostree/src/commit.rs b/crates/composefs-ostree/src/commit.rs index 4091d964..c077c702 100644 --- a/crates/composefs-ostree/src/commit.rs +++ b/crates/composefs-ostree/src/commit.rs @@ -331,8 +331,8 @@ impl CommitWriter { LeafContent::Regular( RegularFile::External(obj_id, _) | RegularFile::ExternalNoVerity(obj_id, _), ) => Some(repo.read_object(obj_id)?), - LeafContent::Regular(RegularFile::Sparse(size)) => { - Some(vec![0u8; *size as usize]) + LeafContent::Regular(RegularFile::Sparse(_)) => { + bail!("Sparse files not supported in ostree commit") } _ => None, };