Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/index_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,17 @@ where
});
}

// An entry shorter than its own header would truncate the slice below the
// header (out-of-bounds access to the header fields later on), and a
// length of zero would keep the entry iterator from ever advancing.
if (self.index_entry_length() as usize) < INDEX_ENTRY_HEADER_SIZE {
return Err(NtfsError::InvalidIndexEntrySize {
position: self.position,
expected: INDEX_ENTRY_HEADER_SIZE as u16,
actual: self.index_entry_length(),
});
}

if self.index_entry_length() as usize > self.slice.len() {
return Err(NtfsError::InvalidIndexEntrySize {
position: self.position,
Expand Down