From 8a4bc8ba2639084b6cc37d59f7143c9c499d95fc Mon Sep 17 00:00:00 2001 From: Jiang Liu Date: Fri, 3 Mar 2023 09:30:43 +0800 Subject: [PATCH] nydus-image: fix a underflow issue in get_compressed_size() Fix a underflow issue in get_compressed_size() by skipping generating useless Tar/Toc headers. Fixes: https://github.com/dragonflyoss/image-service/issues/1129 Signed-off-by: Jiang Liu --- src/bin/nydus-image/core/blob.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/nydus-image/core/blob.rs b/src/bin/nydus-image/core/blob.rs index fae8ed9c579..60229d00ce9 100644 --- a/src/bin/nydus-image/core/blob.rs +++ b/src/bin/nydus-image/core/blob.rs @@ -95,7 +95,9 @@ impl Blob { blob_mgr: &mut BlobManager, blob_writer: &mut ArtifactWriter, ) -> Result<()> { - if ctx.blob_inline_meta || ctx.features.is_enabled(Feature::BlobToc) { + if !ctx.blob_features.contains(BlobFeatures::SEPARATE) + && (ctx.blob_inline_meta || ctx.features.is_enabled(Feature::BlobToc)) + { if let Some((_, blob_ctx)) = blob_mgr.get_current_blob() { blob_ctx.write_tar_header( blob_writer,