Fix ext2 DeviceRangeReader to prevent reading invalid blocks

This commit is contained in:
Qingsong Chen 2025-11-27 09:48:23 +00:00 committed by Tate, Hongliang Tian
parent f026bf38d8
commit d08d82cd0b
1 changed files with 1 additions and 1 deletions

View File

@ -2026,7 +2026,7 @@ impl<'a> DeviceRangeReader<'a> {
// Updates the range
self.range.start += device_range.len() as Ext2Bid;
if device_range.len() == max_cnt {
if device_range.len() == max_cnt && !self.range.is_empty() {
// Updates the indirect block
self.update_indirect_block()?;
}