Fix potential buffer overrun when checking if a packet is RTCP. Also makes validation slightly more robust.
BUG= Review URL: https://webrtc-codereview.appspot.com/1232005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3726 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
0633cccb4f
commit
d8a6e72057
@ -45,6 +45,11 @@ namespace webrtc {
|
||||
|
||||
namespace ModuleRTPUtility {
|
||||
|
||||
enum {
|
||||
kRtcpMinHeaderLength = 4,
|
||||
kRtcpExpectedVersion = 2
|
||||
};
|
||||
|
||||
/*
|
||||
* Time routines.
|
||||
*/
|
||||
@ -269,11 +274,18 @@ bool RTPHeaderParser::RTCP() const {
|
||||
* FMT 15: Application layer FB message
|
||||
*/
|
||||
|
||||
const ptrdiff_t length = _ptrRTPDataEnd - _ptrRTPDataBegin;
|
||||
if (length < kRtcpMinHeaderLength) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const WebRtc_UWord8 V = _ptrRTPDataBegin[0] >> 6;
|
||||
if (V != kRtcpExpectedVersion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const WebRtc_UWord8 payloadType = _ptrRTPDataBegin[1];
|
||||
|
||||
bool RTCP = false;
|
||||
|
||||
// check if this is a RTCP packet
|
||||
switch (payloadType) {
|
||||
case 192:
|
||||
RTCP = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user