sdp: reject large number of channels

the maximum used in practice is multiopus with
6 or 8 channels. 24 is the maximum number of channels
supported in the audio decoder.

BUG=chromium:1265806

Change-Id: Iba8e3185a1f235b846fed9c154e66fb3983664ed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/238980
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@nvidia.com>
Cr-Commit-Position: refs/heads/main@{#35440}
This commit is contained in:
Philipp Hancke
2021-11-25 08:57:54 +01:00
committed by WebRTC LUCI CQ
parent 6c167d8278
commit d58ac5adf8
2 changed files with 19 additions and 0 deletions

View File

@ -257,6 +257,9 @@ static const char kDefaultSctpmapProtocol[] = "webrtc-datachannel";
// types.
const int kWildcardPayloadType = -1;
// Maximum number of channels allowed.
static const size_t kMaxNumberOfChannels = 24;
struct SsrcInfo {
uint32_t ssrc_id;
std::string cname;
@ -3628,6 +3631,10 @@ bool ParseRtpmapAttribute(const std::string& line,
return false;
}
}
if (channels > kMaxNumberOfChannels) {
return ParseFailed(line, "At most 24 channels are supported.", error);
}
AudioContentDescription* audio_desc = media_desc->as_audio();
UpdateCodec(payload_type, encoding_name, clock_rate, 0, channels,
audio_desc);