in src/codec/thrift.rs [127:145]
fn decode(buf: &[u8]) -> Result<(), ParseError> {
let bytes = buf.len() as u32;
if bytes > 4 {
let length = u32::from_be_bytes([buf[0], buf[1], buf[2], buf[3]]);
match length.checked_add(4_u32) {
Some(b) => {
if b == bytes {
Ok(())
} else {
Err(ParseError::Incomplete)
}
}
None => Err(ParseError::Unknown),
}
} else {
Err(ParseError::Incomplete)
}
}