Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 20fd08c

Browse files
committed
fix Transport layer CC unmarshal bug for empty feedbacks
1 parent fd377b1 commit 20fd08c

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
</a>
2727
</p>
2828
<p align="center">
29-
A pure Rust implementation of RTCP. Rewrite <a href="https://github.com/pion/rtcp/releases/tag/v1.2.8">Pion</a> RTCP in Rust
29+
A pure Rust implementation of RTCP. Rewrite <a href="https://github.com/pion/rtcp/releases/tag/v1.2.9">Pion</a> RTCP in Rust
3030
</p>

src/packet.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,34 @@ mod test {
238238
assert!(false, "want error");
239239
}
240240

241+
Ok(())
242+
}
243+
#[test]
244+
fn test_packet_unmarshal_firefox() -> Result<()> {
245+
// issue report from https://github.com/webrtc-rs/srtp/issues/7
246+
let tests = vec![
247+
Bytes::from_static(&[
248+
143, 205, 0, 6, 65, 227, 184, 49, 118, 243, 78, 96, 42, 63, 0, 5, 12, 162, 166, 0,
249+
32, 5, 200, 4, 0, 4, 0, 0,
250+
]),
251+
/*Bytes::from_static(&[
252+
143, 205, 0, 9, 65, 227, 184, 49, 118, 243, 78, 96, 42, 68, 0, 17, 12, 162, 167, 1,
253+
32, 17, 88, 0, 4, 0, 4, 8, 108, 0, 4, 0, 4, 12, 0, 4, 0, 4, 4, 0,
254+
]),
255+
Bytes::from_static(&[
256+
143, 205, 0, 8, 65, 227, 184, 49, 118, 243, 78, 96, 42, 91, 0, 12, 12, 162, 168, 3,
257+
32, 12, 220, 4, 0, 4, 0, 8, 128, 4, 0, 4, 0, 8, 0, 0,
258+
]),
259+
Bytes::from_static(&[
260+
143, 205, 0, 7, 65, 227, 184, 49, 118, 243, 78, 96, 42, 103, 0, 8, 12, 162, 169, 4,
261+
32, 8, 232, 4, 0, 4, 0, 4, 4, 0, 0, 0,
262+
]),*/
263+
];
264+
265+
for mut test in tests {
266+
unmarshal(&mut test)?;
267+
}
268+
241269
Ok(())
242270
}
243271
}

src/transport_feedbacks/transport_layer_cc/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ impl Unmarshal for TransportLayerCc {
590590
// header's length + payload's length
591591
let total_length = 4 * (h.length + 1) as usize;
592592

593-
if total_length <= HEADER_LENGTH + PACKET_CHUNK_OFFSET {
593+
if total_length < HEADER_LENGTH + PACKET_CHUNK_OFFSET {
594594
return Err(Error::PacketTooShort.into());
595595
}
596596

src/transport_feedbacks/transport_layer_cc/transport_layer_cc_test.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,23 @@ fn test_transport_layer_cc_unmarshal() -> Result<()> {
583583
],
584584
},
585585
),
586+
(
587+
"example3",
588+
Bytes::from_static(&[
589+
0x8f, 0xcd, 0x0, 0x4, 0x9a, 0xcb, 0x4, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
590+
0x0, 0x0, 0x0, 0x0, 0x0,
591+
]),
592+
TransportLayerCc {
593+
sender_ssrc: 2596996162,
594+
media_ssrc: 0,
595+
base_sequence_number: 0,
596+
packet_status_count: 0,
597+
reference_time: 0,
598+
fb_pkt_count: 0,
599+
packet_chunks: vec![],
600+
recv_deltas: vec![],
601+
},
602+
),
586603
];
587604

588605
for (name, mut data, want) in tests {

0 commit comments

Comments
 (0)