Skip to content

PackageInspector: raw Cocoa read errors escape the invalidDocx envelope; word/.xml is skipped; pass-1 orphan invariant only implicit (R5 logic L6/L8/L9) #146

Description

@kiki830621

Summary

Three low-severity residues in PackageInspector.imageConsistencyReport (3.7.0, PR #141), all recorded by the R5 logic lens, none reachable from a real package:

  1. L8 — a part or rels that exists but cannot be read (Data(contentsOf:) failing after identity said it is a regular file) escapes as the raw Cocoa error instead of WordError.invalidDocx. Every other "no verdict" path throws invalidDocx.
  2. L9 — a part whose name is exactly the suffix (word/.xml) is skipped by stem(of:ifSuffixed:)'s name.count > suffix.count guard, together with its rels.
  3. L6 — in pass 1, if declare(part:) consumed a rels but scanPart were to fail before referencedByPart[part] is set, the declarations would become orphans; currently unreachable because scanPart records unparsable content parts.

Proposal

Wrap the two Data(contentsOf:) reads in the same invalidDocx envelope; decide whether .xml alone is a part name (probably: refuse it as a package the reader would not produce); add a comment or restructure pass 1 so the invariant is visible.

Source: surfaced during /idd-verify R5 of cluster PR #141 (#137 / #138 / #139), logic lens L6 / L8 / L9. Refs #137.

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions