From 81417069c3e84b708af4b957bc437cfafef20d6f Mon Sep 17 00:00:00 2001 From: Pragyan Poudyal Date: Mon, 13 Oct 2025 17:08:13 +0530 Subject: [PATCH 1/2] erofs: Fix reading directory entries Read inline inode entries only if not empty Before this patch, gathering objects from EROFS, the program panics with the following error ``` thread 'main' panicked at crates/composefs/src/erofs/reader.rs:404:13: range end index 12 out of range for slice of length 0 ``` Signed-off-by: Pragyan Poudyal --- crates/composefs/src/erofs/reader.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/composefs/src/erofs/reader.rs b/crates/composefs/src/erofs/reader.rs index dff97ba..4aadabb 100644 --- a/crates/composefs/src/erofs/reader.rs +++ b/crates/composefs/src/erofs/reader.rs @@ -550,8 +550,10 @@ impl ObjectCollector { self.visit_directory_block(img.directory_block(blkid)); } - let tail = DirectoryBlock::ref_from_bytes(inode.inline()).unwrap(); - self.visit_directory_block(tail); + if !inode.inline().is_empty() { + let inline_block = DirectoryBlock::ref_from_bytes(inode.inline()).unwrap(); + self.visit_directory_block(inline_block); + } } Ok(()) From ee218539e26322194b4d4aa44228038f7b2b9561 Mon Sep 17 00:00:00 2001 From: Pragyan Poudyal Date: Thu, 16 Oct 2025 10:47:02 +0530 Subject: [PATCH 2/2] clippy: Allow manual_is_multiple_of Doing `x % y` is universally understood IMO Signed-off-by: Pragyan Poudyal --- crates/composefs/src/erofs/reader.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/composefs/src/erofs/reader.rs b/crates/composefs/src/erofs/reader.rs index 4aadabb..2ed9df6 100644 --- a/crates/composefs/src/erofs/reader.rs +++ b/crates/composefs/src/erofs/reader.rs @@ -4,6 +4,8 @@ //! images, including inode traversal, directory reading, and object //! reference collection for garbage collection. +#![allow(clippy::manual_is_multiple_of)] + use core::mem::size_of; use std::collections::{BTreeSet, HashSet}; use std::ops::Range;