Skip to content

Commit 0106264

Browse files
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.
1 parent 8b3f6cc commit 0106264

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fuzz/src/router.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
150150
let mut reader = &data[..];
151151
match <$MsgType>::read_from_fixed_length_buffer(&mut reader) {
152152
Ok(msg) => {
153-
assert_eq!(reader.len(), $len);
153+
// Check that we read the slice to the end
154+
assert!(reader.is_empty());
154155
msg
155156
},
156157
Err(e) => match e {

0 commit comments

Comments
 (0)