apm-partition-core
A read-only, no-unsafe Apple Partition Map reader — Driver Descriptor Map and partition entries from a byte buffer.
Decodes the big-endian APM that lets a Mac see the slices on hybrid optical discs and APM-formatted media: block 0's Driver Descriptor Map (ER, carrying the block size) and the PM partition entries (name, type, start block, block count). One parse call over a byte slice; no I/O of its own, no allocations beyond the partition vector.
// `data` begins at the device's first byte (block 0 = Driver Descriptor Map).
let data: = read?;
if let Some = parse
# Ok::
The crate is published as
apm-partition-core(the bareapm-corename is taken on crates.io) but imports asapmvia[lib] name = "apm"— so you writeuse apm::….
What it reads
| Capability | Notes |
|---|---|
| Driver Descriptor Map | ER signature → device block size, sbBlkCount device block count |
| Partition entries | PM entries → name, type, start block, block count, map count, status |
| HFS lookup | hfs_partition() returns the first Apple_HFS/Apple_HFS+ slice |
parse(&[u8]) -> Option<ApplePartitionMap> returns None (rather than erroring or panicking) when the ER/PM signatures are absent or the buffer is too short. The richer Error type and the forensic anomaly pass live in the sibling apm-partition-forensic crate.
An optional serde feature derives Serialize on ApplePartitionMap and ApmPartition for JSON output.
Trust, but verify
This crate parses untrusted, attacker-controllable disk images:
- Panic-free — no
unwrap/expect/panic!in production code (harddenyvia the workspace lints); integers are read through bounds-checked helpers that yield0on a short slice, and the entry count is capped (MAX_PARTITIONS) against a corrupt map. - Fuzzed — a
cargo fuzztarget feeds arbitrary bytes toparsewith a "must not panic" invariant. - Real-artifact validated — checked against a real
hdiutil-created APM, not only synthetic fixtures. - No
unsafe—unsafe_code = "forbid".
Related
Part of the Security Ronin forensic toolkit. The analyzer built on this reader is apm-partition-forensic. Sibling partition readers: gpt-forensic, mbr-forensic. The disk-forensic orchestrator auto-detects the scheme and dispatches to whichever fits.
Privacy Policy · Terms of Service · © 2026 Security Ronin Ltd