Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1405)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_utility.cc

Issue 2498903003: Fix parsing padding byte in rtp header extension (Closed)
Patch Set: double check packet set correctly Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/rtp_utility.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc
index 7dd59736fd044d855d0ae11ed146bd327c948e7f..749539ec03cb41f0d86636c377ed9785cb865700 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc
@@ -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
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_utility.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_utility_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698