Skip to content

Commit

Permalink
Zero extra bytes of FEC recovered packet
Browse files Browse the repository at this point in the history
rtc::CopyOnWriteBuffer::SetSize extends buffer with uninitialized memory by design.
It is up to the user of the rtc::CopyOnWriteBuffer to ensure it is initialized.

Bug: chromium:1403397
Change-Id: Ic0111a84bda32379770ddb1c7d24bee10d96b7a4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/289041
Reviewed-by: Rasmus Brandt <[email protected]>
Commit-Queue: Danil Chapovalov <[email protected]>
Cr-Commit-Position: refs/heads/main@{#38959}
  • Loading branch information
DanilChapovalov authored and WebRTC LUCI CQ committed Dec 27, 2022
1 parent c6409cc commit f52e015
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/rtp_rtcp/source/forward_error_correction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,13 @@ bool ForwardErrorCorrection::FinishPacketRecovery(
"typical IP packet, and is thus dropped.";
return false;
}
size_t old_size = recovered_packet->pkt->data.size();
recovered_packet->pkt->data.SetSize(new_size);
data = recovered_packet->pkt->data.MutableData();
if (new_size > old_size) {
memset(data + old_size, 0, new_size - old_size);
}

// Set the SN field.
ByteWriter<uint16_t>::WriteBigEndian(&data[2], recovered_packet->seq_num);
// Set the SSRC field.
Expand Down

0 comments on commit f52e015

Please sign in to comment.