sdp: check that sctp is on a application content type
regression from
https://webrtc-review.googlesource.com/c/src/+/197813
which attempted to cast the unsupported content type with
a sctp protocol to a application/datachannel one.
BUG=chromium:1171965
Change-Id: I87c63da83b9f49d968e9b045bb1079f687ab226e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/204481
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/master@{#33100}
diff --git a/pc/webrtc_sdp.cc b/pc/webrtc_sdp.cc
index 9544a87..220e752 100644
--- a/pc/webrtc_sdp.cc
+++ b/pc/webrtc_sdp.cc
@@ -3129,7 +3129,8 @@
if (!ParseDtlsSetup(line, &(transport->connection_role), error)) {
return false;
}
- } else if (cricket::IsDtlsSctp(protocol)) {
+ } else if (cricket::IsDtlsSctp(protocol) &&
+ media_type == cricket::MEDIA_TYPE_DATA) {
//
// SCTP specific attributes
//
diff --git a/pc/webrtc_sdp_unittest.cc b/pc/webrtc_sdp_unittest.cc
index 44655fd..296781f 100644
--- a/pc/webrtc_sdp_unittest.cc
+++ b/pc/webrtc_sdp_unittest.cc
@@ -4760,3 +4760,18 @@
ExpectParseFailure(std::string(sdp + "m=application 9 SOMETHING 120\r\n"),
"m=application");
}
+
+// Regression test for:
+// https://bugs.chromium.org/p/chromium/issues/detail?id=1171965
+TEST_F(WebRtcSdpTest, SctpPortInUnsupportedContent) {
+ std::string sdp =
+ "v=0\r\n"
+ "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
+ "s=-\r\n"
+ "t=0 0\r\n"
+ "m=o 1 DTLS/SCTP 5000\r\n"
+ "a=sctp-port\r\n";
+
+ JsepSessionDescription jdesc_output(kDummyType);
+ EXPECT_TRUE(SdpDeserialize(sdp, &jdesc_output));
+}