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}
This commit is contained in:
Philipp Hancke
2021-01-29 09:29:47 +01:00
committed by Commit Bot
parent 1a29a5da84
commit cd467b51ab
2 changed files with 17 additions and 1 deletions

View File

@ -3129,7 +3129,8 @@ bool ParseContent(const std::string& message,
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
//

View File

@ -4760,3 +4760,18 @@ TEST_F(WebRtcSdpTest, MediaTypeProtocolMismatch) {
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));
}