pub(crate) fn check_list_size(
remaining: Option<usize>,
size: usize,
) -> Result<()>Expand description
Reject a declared list size that cannot fit the remaining input. Each list
element is at least one byte on the wire, so a size past the remaining
bytes is a malformed header; bounding it before reserving stops a huge
allocation. remaining is None when the protocol is not backed by a
finite buffer, in which case there is nothing to check against.