Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Unified Diff: webrtc/pc/webrtcsdp_unittest.cc

Issue 2676293003: Fix SDP parsing crash due to missing track ID in "a=msid". (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/pc/webrtcsdp.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/webrtcsdp_unittest.cc
diff --git a/webrtc/pc/webrtcsdp_unittest.cc b/webrtc/pc/webrtcsdp_unittest.cc
index 75116e8e33ec5ac5ec5276546ab65b78c0c9ee6f..1a6a212cdd9f0f1ad704088594e8e76cbc285575 100644
--- a/webrtc/pc/webrtcsdp_unittest.cc
+++ b/webrtc/pc/webrtcsdp_unittest.cc
@@ -3446,3 +3446,36 @@ TEST_F(WebRtcSdpTest, DeserializeInvalidPortInCandidateAttribute) {
JsepSessionDescription jdesc_output(kDummyString);
EXPECT_FALSE(SdpDeserialize(kSdpWithInvalidCandidatePort, &jdesc_output));
}
+
+// Test that "a=msid" with a missing track ID is rejected and doesn't crash.
+// Regression test for:
+// https://bugs.chromium.org/p/chromium/issues/detail?id=686405
+TEST_F(WebRtcSdpTest, DeserializeMsidAttributeWithMissingTrackId) {
+ static const char kSdpWithMissingTrackId[] =
+ "v=0\r\n"
+ "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
+ "s=-\r\n"
+ "t=0 0\r\n"
+ "m=audio 9 RTP/SAVPF 111\r\n"
+ "c=IN IP4 0.0.0.0\r\n"
+ "a=rtpmap:111 opus/48000/2\r\n"
+ "a=msid:stream_id \r\n";
+
+ JsepSessionDescription jdesc_output(kDummyString);
+ EXPECT_FALSE(SdpDeserialize(kSdpWithMissingTrackId, &jdesc_output));
+}
+
+TEST_F(WebRtcSdpTest, DeserializeMsidAttributeWithMissingStreamId) {
+ static const char kSdpWithMissingStreamId[] =
+ "v=0\r\n"
+ "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
+ "s=-\r\n"
+ "t=0 0\r\n"
+ "m=audio 9 RTP/SAVPF 111\r\n"
+ "c=IN IP4 0.0.0.0\r\n"
+ "a=rtpmap:111 opus/48000/2\r\n"
+ "a=msid: track_id\r\n";
+
+ JsepSessionDescription jdesc_output(kDummyString);
+ EXPECT_FALSE(SdpDeserialize(kSdpWithMissingStreamId, &jdesc_output));
+}
« no previous file with comments | « webrtc/pc/webrtcsdp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698