diff --git a/quiche/src/lib.rs b/quiche/src/lib.rs index 4a1bde0245..b6e6122f06 100644 --- a/quiche/src/lib.rs +++ b/quiche/src/lib.rs @@ -3757,9 +3757,12 @@ impl Connection { }, } - let frame = frame::Frame::Padding { - len: active_path.pmtud.get_probe_size() - overhead - 1, - }; + let pmtud_padding: usize = active_path + .pmtud + .get_probe_size() + .saturating_sub(overhead + 1); + + let frame = frame::Frame::Padding { len: pmtud_padding }; if push_frame_to_pkt!(b, frames, frame, left) { let frame = frame::Frame::Ping { @@ -16910,13 +16913,13 @@ mod tests { // Check that PMTU params are configured correctly let pmtu_param = &mut pipe.server.paths.get_mut(pid_1).unwrap().pmtud; - assert_eq!(pmtu_param.get_probe_status(), true); + assert!(pmtu_param.get_probe_status()); assert_eq!(pmtu_param.get_probe_size(), 1350); assert_eq!(pipe.advance(), Ok(())); for (_, p) in pipe.server.paths.iter_mut() { assert_eq!(p.pmtud.get_current(), 1350); - assert_eq!(p.pmtud.get_probe_status(), false); + assert!(!p.pmtud.get_probe_status()); } } @@ -16970,7 +16973,7 @@ mod tests { assert_eq!(pmtu_param.get_current(), 1200); // Continue searching for PMTU - assert_eq!(pmtu_param.get_probe_status(), true); + assert!(pmtu_param.get_probe_status()); } }