Skip to content

$STANDARD_INFORMATION parse failure is indistinguishable from a genuine 1601-01-01 record #573

Closed

Description

@githubrobbi

The gap

parse_standard_info_full returns silently when it cannot parse $STANDARD_INFORMATION:

  • the resident-attribute header fields (value_length at +16, value_offset at +20) fall outside the record,
  • value_length is below 36 (neither the NTFS 3.0+ nor the 1.2 branch matches), or
  • the payload runs past the end of the buffer.

In all three cases ExtendedStandardInfo is left at Default, so the four timestamps read 0. FILETIME 0 is 1601-01-01, which is indistinguishable from a record whose $SI genuinely says 1601-01-01. Nothing anywhere records that the attribute failed to parse.

is_corrupt does not cover this. It is set only by the caller on fixup/USA failure (parse/forensic.rs:39,45); full.rs:680 hardcodes is_corrupt: false. There is no attribute-level damage representation in the crate at all. A record whose USA checks out but whose $SI is truncated or garbage parses as "fine" and reports 1601-01-01 as fact.

Scope: this is not a fragment-parser bug

parse_standard_info_full is called by io/parser/unified.rs:160 (bulk load) and parse/direct_index.rs:270 (live USN journal) — the two parsers every UFFS user runs — as well as parse/full.rs:120 (the public parse_record_full) and, as of the fix below, the deprecated fragment parser. The silent-default behavior predates all of this and lives in the bulk path.

Filed separately from #572 (fragment-parser removal) for that reason: if #572 closes as "delete the fragment parser," this must not close with it.

Incidence: latent, not live

Measured on real captures: 0 occurrences in 3,107,770 parsed records (drive C) and 0 in 15,079 (drive G). Every record had a $SI; none defaulted. This is not a current data-quality problem — it bites only on damaged or carved images, which is exactly the forensics use case. Deferring it is a decision, not a gamble.

Fix shape

Have parse_standard_info_full return a status instead of ():

enum StdInfoParse { V30, V12, Absent, Malformed }

Callers that don't care ignore the return value (let _ = ...), so the bulk paths are unaffected. Surface it as si_malformed on ParsedRecord (a plain bool there is free — the struct already has a forensic bool block).

If it is also packed into FileRecord::forensic_flags, it must take bit 6 or 7. Bits 0-5 are all occupied:

bit meaning
0 is_deleted
1 is_corrupt
2 is_extension
3 has_default_data
4 has_i30_stream
5 is_unified
6-7 free

set_forensic_flags preserves & 0b11_1000 precisely because 3-5 are in use. Writing into bit 3 would corrupt has_default_data, which compute_tree_metrics uses to distinguish "empty $DATA" from "no $DATA" — the damage would surface as wrong treesize/tree_allocated, far from the cause.

Note on a behavior change already landed

fix(mft): stop zeroing usn/security_id/owner_id in the fragment parser routed the fragment path through this shared helper. That was right for correctness, but it is worth recording that it was not neutral for carving:

  • Before: a malformed $SI hit break, aborting the whole attribute walk. Any $FILE_NAME/$DATA after the $SI was lost, so the record usually came out nameless. That is not a damage signal — it is data loss that happens to be conspicuous.
  • After: $SI is left at default, the loop continues, names and streams survive, and the record looks entirely normal while reporting 1601-01-01.

A loud accidental artifact was traded for a quiet wrong answer. Correct for the bulk path; a real loss of signal for carving, and the reason this issue exists.

Activity

  1. githubrobbi commented on Jul 21, 2026

    @githubrobbi
    CollaboratorAuthor

    Resolved at the parse layer in c1c317ff5.

    What landed

    parse_standard_info_full now returns StdInfoParse instead of ():

    variant meaning
    V30 decoded as the 72-byte NTFS 3.0+ layout
    V12 decoded as the 36-byte NTFS 1.2 layout — missing extended fields are correct, not damage
    Malformed present but undecodable: resident header past the end of the record, declared length under the 36-byte minimum, or payload overrunning the buffer (all three silent-return paths from the issue)
    Absent no $SI attribute at all — unusual, but not evidence of damage, so deliberately distinct from Malformed

    Plus is_malformed() / is_decoded() helpers, and ParsedRecord::std_info_parse so the status reaches the public API (parse_record_full, parse_record_forensic) where an external index reads from. forensic/base.rs threads it too.

    Cost, measured

    • ParsedRecord is still 256 bytes. The field lands in existing padding (fields summed to 252 before), verified with size_of before and after.
    • StdInfoParse is 1 byte, returned in a register.
    • No new work. The variant is just which branch the parser had already taken.
    • Bulk paths pay nothing. unified.rs, direct_index.rs and the fragment parser discard the value, so it is dead and removed.
    • No index, cache, or on-disk format change.

    Deliberately not #[must_use]: the bulk pipelines have nowhere to record the status, and dropping it there is the correct choice rather than an oversight worth a lint. Each of the three sites says so in a comment.

    Deliberately not built

    Representation — a searchable column, DataFrame projection, the daemon's shmem row — was descoped by the consumer, who builds a separate index and owns representation there. This issue is closed on the groundwork: the information now exists and is reachable at the parse layer.

    If UFFS's own index and DataFrame output should ever carry it, that is a new issue, not a reopen of this one. It would take bit 6 or 7 of FileRecord::forensic_flags — bits 0-5 are all occupied, and bit 3 (has_default_data) feeds compute_tree_metrics, so clobbering it surfaces as wrong treesize/tree_allocated far from the cause. The bit table on the accessor block was completed in dd099001c, since its truncated version is what made bit 3 look free in the first place.

    Coverage

    undecodable_standard_info_reports_malformed_not_a_1601_timestamp pins all three Malformed conditions and the pair this exists to separate: a genuine all-zero (1601-01-01) $SI returns V30, while an undecodable one returns Malformed with identical timestamps. parse_record_full_reports_the_standard_info_parse_status pins that the status survives to the public API for both Malformed and Absent.

    Incidence recorded above is unchanged and still the reason this was safe to do as groundwork rather than a hotfix: 0 in 3,107,770 records (drive C), 0 in 15,079 (drive G).

  2. added a commit that references this issue on Jul 31, 2026
    73cf363
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions