Index: webrtc/pc/webrtcsdp_unittest.cc |
diff --git a/webrtc/pc/webrtcsdp_unittest.cc b/webrtc/pc/webrtcsdp_unittest.cc |
index 81a5aaf4fe65634bb5bf78b66d08fe46425aeeee..75116e8e33ec5ac5ec5276546ab65b78c0c9ee6f 100644 |
--- a/webrtc/pc/webrtcsdp_unittest.cc |
+++ b/webrtc/pc/webrtcsdp_unittest.cc |
@@ -3424,3 +3424,25 @@ TEST_F(WebRtcSdpTest, IceCredentialsInCandidateStringIgnored) { |
EXPECT_EQ("ufrag_voice", c.username()); |
EXPECT_EQ("pwd_voice", c.password()); |
} |
+ |
+// Test that SDP with an invalid port number in "a=candidate" lines is |
+// rejected, without crashing. |
+// Regression test for: |
+// https://bugs.chromium.org/p/chromium/issues/detail?id=677029 |
+TEST_F(WebRtcSdpTest, DeserializeInvalidPortInCandidateAttribute) { |
+ static const char kSdpWithInvalidCandidatePort[] = |
+ "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=rtcp:9 IN IP4 0.0.0.0\r\n" |
+ "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n" |
+ "a=rtpmap:111 opus/48000/2\r\n" |
+ "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 12345678 typ host " |
+ "generation 2 raddr 192.168.1.1 rport 87654321\r\n"; |
+ |
+ JsepSessionDescription jdesc_output(kDummyString); |
+ EXPECT_FALSE(SdpDeserialize(kSdpWithInvalidCandidatePort, &jdesc_output)); |
+} |