From 6eb922610fa5b1c76c61f7e20ff56039e310991b Mon Sep 17 00:00:00 2001 From: Oakchris1955 <80592203+Oakchris1955@users.noreply.github.com> Date: Sun, 11 Aug 2024 15:33:24 +0300 Subject: [PATCH] fix: fix potential bug when File read stops at the end of a sector --- src/fs.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fs.rs b/src/fs.rs index ab75230..d1ad8ad 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -756,7 +756,9 @@ where if bytes_read >= read_cap { // ...but we must process get the next cluster for future uses, // we do that before breaking - if self.offset % self.fs.cluster_size() == 0 { + if self.offset % self.fs.cluster_size() == 0 + && self.offset < self.file_size.into() + { self.next_cluster()?; }