From 0106264782255e71985438ee2ced34f584eb97d4 Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Mon, 31 Mar 2025 12:05:19 -0400 Subject: [PATCH] Fix router fuzz failure due to LengthLimitedReader We recently switched the decode_msg macro in the router fuzz target from reading from a Cursor to reading from a slice. This caused a failure because the slice advances its pointer as it is being read from, so asserting that the length of the slice is equal to the length of the message that was read no longer works. Instead assert that the original fuzz data length is equal to the length of the message that was read. --- fuzz/src/router.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fuzz/src/router.rs b/fuzz/src/router.rs index fd97d084f25..61a034feb1c 100644 --- a/fuzz/src/router.rs +++ b/fuzz/src/router.rs @@ -150,7 +150,8 @@ pub fn do_test(data: &[u8], out: Out) { let mut reader = &data[..]; match <$MsgType>::read_from_fixed_length_buffer(&mut reader) { Ok(msg) => { - assert_eq!(reader.len(), $len); + // Check that we read the slice to the end + assert!(reader.is_empty()); msg }, Err(e) => match e {