Skip to main content

Module read

Module read 

Source
Expand description

Bounds-checked integer/byte readers over attacker-controllable image data.

Every accessor returns a value (0 / empty on out-of-range) rather than panicking or indexing out of bounds — a length or offset field taken from the image can be arbitrary, so reads are validated against the slice length first (Paranoid Gatekeeper).

Functions§

bytes16
Copies a fixed 16-byte array (a UUID / key half) at off, zero-filled if the range is out of bounds.
le_u16
Reads a little-endian u16 at off, or 0 if the 2 bytes are out of range.
le_u32
Reads a little-endian u32 at off, or 0 if the 4 bytes are out of range.
le_u48
Reads a little-endian 6-byte block number at off (widened to u64), or 0 if out of range. CoreStorage stores physical-volume block numbers as 48-bit little-endian values.
le_u64
Reads a little-endian u64 at off, or 0 if the 8 bytes are out of range.