|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Flat-memory backing for the shared unarchiver read seam. More...
Go to the source code of this file.
Functions | |
| size_t | unarch_mem_read (void *ctx, uint64_t offset, void *buf, size_t len) |
| unarch_read_fn over a flat unarch_mem_t view. | |
Flat-memory backing for the shared unarchiver read seam.
The one trivial unarch_read_fn implementation everybody shares: a bounds-clamped copy out of a unarch_mem_t view. Reads never touch a byte outside [base, base + len) regardless of the (untrusted) offset and length arguments, so the wrapped-open paths can point it at a decompressed arena without further guarding.
Definition in file unarch_io.c.
|
nodiscard |
unarch_read_fn over a flat unarch_mem_t view.
Serves [offset, offset + len) clamped to the view's bounds by plain copy. Reads at or past the end return 0 (EOF); a NULL context or view base also returns 0, which every decoder treats as a failed read (fail-closed).
| [in] | ctx | The unarch_mem_t view (may be NULL: reads 0). |
| [in] | offset | Absolute byte offset within the view. |
| [out] | buf | Destination buffer (len writable bytes, non-NULL). |
| [in] | len | Bytes requested. |
| 0 | NULL view / NULL destination, EOF, or a zero-length request. |
buf holds len writable bytes when len > 0. buf are written; nothing else changes. Definition at line 24 of file unarch_io.c.
References unarch_mem_t::base, unarch_mem_t::len, and memcpy().
Referenced by internal_open_unwrapped().