Reject RTP one-byte extension ID 0.
Only accept local identifiers in the range 1-14 inclusive. BUG=1788, chromium:471328 R=asapersson@webrtc.org Review URL: https://webrtc-codereview.appspot.com/50549004 Cr-Commit-Position: refs/heads/master@{#8900}
This commit is contained in:
parent
903c0f2e76
commit
23914fe756
@ -189,7 +189,7 @@ static bool ValidateRtpHeaderExtensionIds(
|
||||
const std::vector<RtpHeaderExtension>& extensions) {
|
||||
std::set<int> extensions_used;
|
||||
for (size_t i = 0; i < extensions.size(); ++i) {
|
||||
if (extensions[i].id < 0 || extensions[i].id >= 15 ||
|
||||
if (extensions[i].id <= 0 || extensions[i].id >= 15 ||
|
||||
!extensions_used.insert(extensions[i].id).second) {
|
||||
LOG(LS_ERROR) << "RTP extensions are with incorrect or duplicate ids.";
|
||||
return false;
|
||||
|
@ -1301,7 +1301,7 @@ TEST_F(WebRtcVideoChannel2Test,
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVideoChannel2Test, SetSendRtpHeaderExtensionsRejectsIncorrectIds) {
|
||||
const int kIncorrectIds[] = {-2, -1, 15, 16};
|
||||
const int kIncorrectIds[] = {-2, -1, 0, 15, 16};
|
||||
for (size_t i = 0; i < arraysize(kIncorrectIds); ++i) {
|
||||
std::vector<cricket::RtpHeaderExtension> extensions;
|
||||
extensions.push_back(cricket::RtpHeaderExtension(
|
||||
@ -1312,7 +1312,7 @@ TEST_F(WebRtcVideoChannel2Test, SetSendRtpHeaderExtensionsRejectsIncorrectIds) {
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVideoChannel2Test, SetRecvRtpHeaderExtensionsRejectsIncorrectIds) {
|
||||
const int kIncorrectIds[] = {-2, -1, 15, 16};
|
||||
const int kIncorrectIds[] = {-2, -1, 0, 15, 16};
|
||||
for (size_t i = 0; i < arraysize(kIncorrectIds); ++i) {
|
||||
std::vector<cricket::RtpHeaderExtension> extensions;
|
||||
extensions.push_back(cricket::RtpHeaderExtension(
|
||||
|
@ -174,6 +174,9 @@ VideoReceiveStream::VideoReceiveStream(webrtc::VideoEngine* video_engine,
|
||||
for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) {
|
||||
const std::string& extension = config_.rtp.extensions[i].name;
|
||||
int id = config_.rtp.extensions[i].id;
|
||||
// One-byte-extension local identifiers are in the range 1-14 inclusive.
|
||||
DCHECK_GE(id, 1);
|
||||
DCHECK_LE(id, 14);
|
||||
if (extension == RtpExtension::kTOffset) {
|
||||
CHECK_EQ(0,
|
||||
rtp_rtcp_->SetReceiveTimestampOffsetStatus(channel_, true, id));
|
||||
|
@ -131,6 +131,9 @@ VideoSendStream::VideoSendStream(
|
||||
for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) {
|
||||
const std::string& extension = config_.rtp.extensions[i].name;
|
||||
int id = config_.rtp.extensions[i].id;
|
||||
// One-byte-extension local identifiers are in the range 1-14 inclusive.
|
||||
DCHECK_GE(id, 1);
|
||||
DCHECK_LE(id, 14);
|
||||
if (extension == RtpExtension::kTOffset) {
|
||||
CHECK_EQ(0, rtp_rtcp_->SetSendTimestampOffsetStatus(channel_, true, id));
|
||||
} else if (extension == RtpExtension::kAbsSendTime) {
|
||||
|
Loading…
Reference in New Issue
Block a user