File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
crates/uffs-mft/src/io/readers/parallel Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -380,7 +380,33 @@ impl ParallelMftReader {
380380 // Check bitmap
381381 if let Some ( bm) = bitmap_ref {
382382 if !bm. is_record_in_use ( frs) {
383- continue ;
383+ // Bitmap says unused, but extension records have IN_USE
384+ // set in their header while NOT being marked in $Bitmap.
385+ // Peek at the FILE record header flags (offset 0x16, 2 bytes LE)
386+ // before skipping.
387+ let offset = i * record_size;
388+ let record_slice = & buffer_slice[ offset..offset + record_size] ;
389+
390+ /// Flags offset in FILE_RECORD_SEGMENT_HEADER.
391+ const FLAGS_OFFSET : usize = 0x16 ;
392+ /// IN_USE flag bit in
393+ /// FILE_RECORD_SEGMENT_HEADER.flags.
394+ const IN_USE_FLAG : u16 = 0x0001 ;
395+
396+ if record_slice. len ( ) > FLAGS_OFFSET + 1 {
397+ let flags = u16:: from_le_bytes ( [
398+ record_slice[ FLAGS_OFFSET ] ,
399+ record_slice[ FLAGS_OFFSET + 1 ] ,
400+ ] ) ;
401+ if flags & IN_USE_FLAG == 0 {
402+ // Record header also says not in use — safe to skip
403+ continue ;
404+ }
405+ // Header says IN_USE — this is an extension
406+ // record, process it
407+ } else {
408+ continue ;
409+ }
384410 }
385411 }
386412
You can’t perform that action at this time.
0 commit comments