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}
diff --git a/modules/rtp_rtcp/source/ulpfec_receiver_impl.cc b/modules/rtp_rtcp/source/ulpfec_receiver_impl.cc
index 24348f3..ea85422 100644
--- a/modules/rtp_rtcp/source/ulpfec_receiver_impl.cc
+++ b/modules/rtp_rtcp/source/ulpfec_receiver_impl.cc
@@ -172,15 +172,18 @@
       // 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_);
   }