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

Unified Diff: net/quic/quic_framer.cc

Issue 156233004: Add a LOG(DFATAL) if the sequence number length is too small to fit the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | net/quic/quic_framer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_framer.cc
diff --git a/net/quic/quic_framer.cc b/net/quic/quic_framer.cc
index 588db7483ed4c689284962f34eaf8e200c1f9fe0..90d9a89b829ab59946dd2797bb42ad2748e40af3 100644
--- a/net/quic/quic_framer.cc
+++ b/net/quic/quic_framer.cc
@@ -2049,6 +2049,15 @@ bool QuicFramer::AppendAckFrameAndTypeByte(
DCHECK_GE(header.packet_sequence_number, frame.sent_info.least_unacked);
const QuicPacketSequenceNumber least_unacked_delta =
header.packet_sequence_number - frame.sent_info.least_unacked;
+ const QuicPacketSequenceNumber length_shift =
+ header.public_header.sequence_number_length * 8;
+ if (least_unacked_delta >> length_shift > 0) {
+ LOG(DFATAL) << "sequence_number_length "
+ << header.public_header.sequence_number_length
+ << " is too small for least_unacked_delta: "
+ << least_unacked_delta;
+ return false;
+ }
if (!AppendPacketSequenceNumber(header.public_header.sequence_number_length,
least_unacked_delta, writer)) {
return false;
« no previous file with comments | « no previous file | net/quic/quic_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698