Skip to main content

Module bytes

Module bytes 

Source
Expand description

Bounds-checked little-endian integer readers.

Registry hives are untrusted, attacker-controllable input. These helpers read fixed-width integers without ever panicking on a crafted offset/length: an out-of-range read yields 0 rather than an out-of-bounds slice panic. Using them (instead of data[a..b].try_into().unwrap()) keeps the parser panic-free even if a future change breaks a caller’s bounds guard — the defence-in-depth the Paranoid-Gatekeeper standard requires.

Functions§

le_u32
Read a little-endian u32 at off, or 0 if off..off+4 is out of range.
le_u64
Read a little-endian u64 at off, or 0 if off..off+8 is out of range.