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

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

Issue 2677073002: Fix potential use after free in H264 packetizer. (Closed)
Patch Set: Created 3 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc b/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
index 99f5d6ca5413598901b7423137c354084c1850b1..5d631b504d60283ebca19da41420783353faed28 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
@@ -293,6 +293,7 @@ void RtpPacketizerH264::NextAggregatePacket(RtpPacketToSend* rtp_packet) {
// STAP-A NALU header.
buffer[0] = (packet->header & (kFBit | kNriMask)) | H264::NaluType::kStapA;
size_t index = kNalHeaderSize;
+ bool is_last_fragment = packet->last_fragment;
while (packet->aggregated) {
const Fragment& fragment = packet->source_fragment;
// Add NAL unit length field.
@@ -303,11 +304,12 @@ void RtpPacketizerH264::NextAggregatePacket(RtpPacketToSend* rtp_packet) {
index += fragment.length;
packets_.pop();
input_fragments_.pop_front();
- if (packet->last_fragment)
+ if (is_last_fragment)
break;
packet = &packets_.front();
+ is_last_fragment = packet->last_fragment;
}
- RTC_CHECK(packet->last_fragment);
+ RTC_CHECK(is_last_fragment);
rtp_packet->SetPayloadSize(index);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698