fn read_bytes_from_finite_reader<D: Read + ?Sized>( d: &mut D, opts: ReadBytesFromFiniteReaderOpts, ) -> Result<Vec<u8>, Error>
Read opts.len bytes from reader, where opts.len could potentially be malicious.
opts.len
Adapted from https://github.com/rust-bitcoin/rust-bitcoin/blob/e2b9555070d9357fb552e56085fb6fb3f0274560/bitcoin/src/consensus/encode.rs#L659