Documentation
¶
Overview ¶
Package limitio provides bounded reads that fail loudly when an input exceeds a byte cap. It exists because the stdlib's io.LimitReader silently returns io.EOF at its limit — indistinguishable from a genuinely short input — which is the wrong behavior when the goal is to reject oversized untrusted data (decompression bombs, attacker-supplied artifacts) rather than truncate it.
The cap is inclusive: exactly max bytes is allowed; the first byte past max surfaces ErrTooLarge.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTooLarge = errors.New("limitio: input exceeds maximum allowed size")
ErrTooLarge is returned when a bounded read would exceed its cap.
Functions ¶
func ReadAll ¶
ReadAll reads all of r into memory, failing with ErrTooLarge if r yields more than max bytes. It is the bounded counterpart to io.ReadAll.
Types ¶
This section is empty.