Log an error in RtpDemuxer::FindSsrcAssociations() if kMaxProcessedSsrcs exceeded

BUG=None

Review-Url: https://codereview.webrtc.org/2941513002
Cr-Commit-Position: refs/heads/master@{#18569}
This commit is contained in:
eladalon 2017-06-13 07:57:31 -07:00 committed by Commit Bot
parent 7ed35f4643
commit dea075c7a6
2 changed files with 10 additions and 1 deletions

View File

@ -8,8 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/base/checks.h"
#include "webrtc/call/rtp_demuxer.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/call/rtp_packet_sink_interface.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
@ -118,6 +120,10 @@ void RtpDemuxer::FindSsrcAssociations(const RtpPacketReceived& packet) {
if (processed_ssrcs_.size() < kMaxProcessedSsrcs) { // Prevent memory overuse
processed_ssrcs_.insert(packet.Ssrc()); // Avoid re-examining in-depth.
} else if (!logged_max_processed_ssrcs_exceeded_) {
LOG(LS_WARNING) << "More than " << kMaxProcessedSsrcs
<< " different SSRCs seen.";
logged_max_processed_ssrcs_exceeded_ = true;
}
}

View File

@ -70,6 +70,9 @@ class RtpDemuxer {
// check RSIDs for the first packet on each incoming SSRC stream.
// (If RSID associations are added later, we check again.)
std::set<uint32_t> processed_ssrcs_;
// Avoid an attack that would create excessive logging.
bool logged_max_processed_ssrcs_exceeded_ = false;
};
} // namespace webrtc