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

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

Issue 1220753003: Prevent OOB reads in FEC packets without complete RED headers. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback + updated comment Created 5 years, 6 months 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
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/fec_receiver_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/fec_receiver_impl.cc
diff --git a/webrtc/modules/rtp_rtcp/source/fec_receiver_impl.cc b/webrtc/modules/rtp_rtcp/source/fec_receiver_impl.cc
index ce240860a5881cf6b2260054611db071f7e2b9de..cf46ca9c333353e0eefba6e7cad59c65ab8c9e47 100644
--- a/webrtc/modules/rtp_rtcp/source/fec_receiver_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/fec_receiver_impl.cc
@@ -104,7 +104,7 @@ int32_t FecReceiverImpl::AddReceivedRedPacket(
if (incoming_rtp_packet[header.headerLength] & 0x80) {
// f bit set in RED header
REDHeaderLength = 4;
- if (payload_data_length < REDHeaderLength) {
+ if (payload_data_length < REDHeaderLength + 1u) {
LOG(LS_WARNING) << "Corrupt/truncated FEC packet.";
return -1;
}
@@ -128,7 +128,9 @@ int32_t FecReceiverImpl::AddReceivedRedPacket(
LOG(LS_WARNING) << "More than 2 blocks in packet not supported.";
return -1;
}
- if (blockLength > payload_data_length - REDHeaderLength) {
+ // Check that the packet is long enough to contain data in the following
+ // block.
+ if (blockLength > payload_data_length - (REDHeaderLength + 1)) {
LOG(LS_WARNING) << "Block length longer than packet.";
return -1;
}
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/fec_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698