Skip to content

Commit

Permalink
Add reproducer for bug 2227
Browse files Browse the repository at this point in the history
  • Loading branch information
ctz committed Nov 22, 2024
1 parent 69b6f74 commit ffe646d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions rustls/tests/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8155,4 +8155,32 @@ fn tls13_packed_handshake() {
);
}

#[test]
fn large_client_hello() {
let (_, mut server) = make_pair(KeyType::Rsa2048);
let hello = include_bytes!("data/bug2227-clienthello.bin");
let mut cursor = io::Cursor::new(hello);
loop {
if server.read_tls(&mut cursor).unwrap() == 0 {
break;
}
server.process_new_packets().unwrap();
}
}

#[test]
fn large_client_hello_acceptor() {
let mut acceptor = rustls::server::Acceptor::default();
let hello = include_bytes!("data/bug2227-clienthello.bin");
let mut cursor = io::Cursor::new(hello);
loop {
acceptor.read_tls(&mut cursor).unwrap();

if let Some(accepted) = acceptor.accept().unwrap() {
println!("{accepted:?}");
break;
}
}
}

const CONFIDENTIALITY_LIMIT: u64 = 1024;
Binary file added rustls/tests/data/bug2227-clienthello.bin
Binary file not shown.

0 comments on commit ffe646d

Please sign in to comment.