Skip to content

Commit ffe646d

Browse files
committed
Add reproducer for bug 2227
1 parent 69b6f74 commit ffe646d

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

rustls/tests/api.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8155,4 +8155,32 @@ fn tls13_packed_handshake() {
81558155
);
81568156
}
81578157

8158+
#[test]
8159+
fn large_client_hello() {
8160+
let (_, mut server) = make_pair(KeyType::Rsa2048);
8161+
let hello = include_bytes!("data/bug2227-clienthello.bin");
8162+
let mut cursor = io::Cursor::new(hello);
8163+
loop {
8164+
if server.read_tls(&mut cursor).unwrap() == 0 {
8165+
break;
8166+
}
8167+
server.process_new_packets().unwrap();
8168+
}
8169+
}
8170+
8171+
#[test]
8172+
fn large_client_hello_acceptor() {
8173+
let mut acceptor = rustls::server::Acceptor::default();
8174+
let hello = include_bytes!("data/bug2227-clienthello.bin");
8175+
let mut cursor = io::Cursor::new(hello);
8176+
loop {
8177+
acceptor.read_tls(&mut cursor).unwrap();
8178+
8179+
if let Some(accepted) = acceptor.accept().unwrap() {
8180+
println!("{accepted:?}");
8181+
break;
8182+
}
8183+
}
8184+
}
8185+
81588186
const CONFIDENTIALITY_LIMIT: u64 = 1024;
21.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)