Fix parsing padding byte in rtp header extension

BUG=chromium:664598

Review-Url: https://codereview.webrtc.org/2498903003
Cr-Commit-Position: refs/heads/master@{#15230}
This commit is contained in:
danilchap
2016-11-24 09:06:05 -08:00
committed by Commit bot
parent bf67663eb1
commit b7374dba6b
4 changed files with 247 additions and 19 deletions

View File

@ -318,8 +318,13 @@ void RtpHeaderParser::ParseOneByteExtensionHeader(
const int len = (*ptr & 0x0f);
ptr++;
if (id == 0) {
// Padding byte, skip ignoring len.
continue;
}
if (id == 15) {
LOG(LS_WARNING)
LOG(LS_VERBOSE)
<< "RTP extension header 15 encountered. Terminate parsing.";
return;
}
@ -446,23 +451,8 @@ void RtpHeaderParser::ParseOneByteExtensionHeader(
}
}
ptr += (len + 1);
uint8_t num_bytes = ParsePaddingBytes(ptrRTPDataExtensionEnd, ptr);
ptr += num_bytes;
}
}
uint8_t RtpHeaderParser::ParsePaddingBytes(
const uint8_t* ptrRTPDataExtensionEnd,
const uint8_t* ptr) const {
uint8_t num_zero_bytes = 0;
while (ptrRTPDataExtensionEnd - ptr > 0) {
if (*ptr != 0) {
return num_zero_bytes;
}
ptr++;
num_zero_bytes++;
}
return num_zero_bytes;
}
} // namespace RtpUtility
} // namespace webrtc