In ulpfec receiver check for malformed packets to avoid DCHECKS tirggering

If the packet can't be parsed, the buffer isn't moved to the packet.
Then, a new empty buffer is moved back from the packet.
Thus, the consequtive DCHECK fails because the data isn't the same anymore.

Bug: chromium:1009236
Change-Id: Ie27f438c40f38074d42d8491fe03df45d50eba50
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155162
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29340}
This commit is contained in:
Ilya Nikolaevskiy
2019-09-30 11:36:42 +02:00
committed by Commit Bot
parent 2449d7aa78
commit e7314cd4a2

View File

@ -172,15 +172,18 @@ int32_t UlpfecReceiverImpl::ProcessReceivedFec() {
// Create a packet with the buffer to modify it.
RtpPacketReceived rtp_packet;
const uint8_t* const original_data = packet->data.cdata();
rtp_packet.Parse(packet->data);
rtp_packet.IdentifyExtensions(extensions_);
// Reset buffer reference, so zeroing would work on a buffer with a
// single reference.
packet->data = rtc::CopyOnWriteBuffer(0);
rtp_packet.ZeroMutableExtensions();
packet->data = rtp_packet.Buffer();
// Ensure that zeroing of extensions was done in place.
RTC_DCHECK_EQ(packet->data.cdata(), original_data);
if (!rtp_packet.Parse(packet->data)) {
RTC_LOG(LS_WARNING) << "Corrupted media packet";
} else {
rtp_packet.IdentifyExtensions(extensions_);
// Reset buffer reference, so zeroing would work on a buffer with a
// single reference.
packet->data = rtc::CopyOnWriteBuffer(0);
rtp_packet.ZeroMutableExtensions();
packet->data = rtp_packet.Buffer();
// Ensure that zeroing of extensions was done in place.
RTC_DCHECK_EQ(packet->data.cdata(), original_data);
}
}
fec_->DecodeFec(*received_packet, &recovered_packets_);
}