fix(tvix/nix-compat/wire/bytes): return UnexpectedEof for unexpected EOF

Change-Id: I8cb79f93742cc3a9088701bc8c2795de893eb6a8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11547
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
edef 2024-04-30 08:55:39 +00:00
parent fd5fc31e65
commit 88f49c8351

View file

@ -61,10 +61,7 @@ where
// make sure we got exactly the number of bytes, and not less.
if s as u64 != padded_len {
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidData,
"got less bytes than expected",
));
return Err(std::io::ErrorKind::UnexpectedEof.into());
}
let (_content, padding) = buf.split_at(len as usize);