Skip to content

Commit

Permalink
Fix broken unit test cases caused by overflow issues. (Tencent#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaofei0800 authored Dec 1, 2023
1 parent 3e7b305 commit 5d62bbe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/connection/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4694,7 +4694,7 @@ pub(crate) mod tests {
assert!(!packets.is_empty());
let packet = &mut packets[0].0;
let packet_len = packet.len();
packet[packet_len - 1] += 1;
packet[packet_len - 1] = packet[packet_len - 1].wrapping_add(1);

// Server recv a corrupted Handshake
TestPair::conn_packets_in(&mut test_pair.server, packets)?;
Expand Down Expand Up @@ -5520,7 +5520,7 @@ pub(crate) mod tests {

// Tamper dcid field of the OneRTT packet
let (mut packet, info) = packets.pop().unwrap();
packet[1] = packet[1] + 1; // change first byte of dcid field
packet[1] = packet[1].wrapping_add(1); // change first byte of dcid field

// Server drop the packet with unknown dcid
assert!(test_pair.server.recv(&mut packet, &info).is_ok());
Expand Down
2 changes: 1 addition & 1 deletion src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,7 @@ mod tests {
}

#[test]
fn handshake_with_packet_dupulication() -> Result<()> {
fn handshake_with_packet_duplication() -> Result<()> {
let mut t = TestPair::new();

let mut case_conf = CaseConf::default();
Expand Down

0 comments on commit 5d62bbe

Please sign in to comment.