Skip to content

Commit

Permalink
proto: add test case for encoding issue
Browse files Browse the repository at this point in the history
  • Loading branch information
djc authored and bluejekyll committed Oct 17, 2022
1 parent 1e58334 commit 412b218
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/proto/src/serialize/binary/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ mod tests {
use crate::{
op::{Message, Query},
rr::{rdata::SRV, RData, Record, RecordType},
serialize::binary::BinDecodable,
};
use crate::{rr::Name, serialize::binary::BinDecoder};

Expand Down Expand Up @@ -644,4 +645,11 @@ mod tests {
// check re-serializing
assert!(Message::from_vec(&bytes).is_ok());
}

#[test]
fn test_fuzzed() {
const MESSAGE: &[u8] = include_bytes!("../../../tests/test-data/fuzz-long.rdata");
let msg = Message::from_bytes(MESSAGE).unwrap();
msg.to_bytes().unwrap();
}
}
Binary file added crates/proto/tests/test-data/fuzz-long.rdata
Binary file not shown.

0 comments on commit 412b218

Please sign in to comment.