Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/ntfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Finck <colin@reactos.org>2021-12-08 22:15:37 +0300
committerColin Finck <colin@reactos.org>2021-12-08 22:15:37 +0300
commit14b8be0c9ab74257738cb36d7683386604c4bbac (patch)
treeb67309f4ef79c6be59a522db749a0cdc1063056e
parent15e288dbee06bb85cb11ca37505dcf7d5e76677d (diff)
Fix calculation in `NtfsAttribute::non_resident_value_data_and_position`
The attribute length is relative to the attribute start, not to the data runs start! This 64 byte difference previously caused a panic when data run information filled the entire File Record, and `end` was outside the File Record boundaries.
-rw-r--r--src/attribute.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/attribute.rs b/src/attribute.rs
index a5abf11..e6c1fd2 100644
--- a/src/attribute.rs
+++ b/src/attribute.rs
@@ -220,7 +220,7 @@ impl<'n, 'f> NtfsAttribute<'n, 'f> {
pub(crate) fn non_resident_value_data_and_position(&self) -> (&'f [u8], u64) {
debug_assert!(!self.is_resident());
let start = self.offset + self.non_resident_value_data_runs_offset() as usize;
- let end = start + self.attribute_length() as usize;
+ let end = self.offset + self.attribute_length() as usize;
let data = &self.file.record_data()[start..end];
let position = self.file.position() + start as u64;