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

Unified Diff: net/spdy/spdy_framer.cc

Issue 989283002: Fix off-by-one in SpdyFramer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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: net/spdy/spdy_framer.cc
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index dbb3fff59c8dd02ad781b11e8cfdf7ee3c30f101..4b5866e60077db58724a4f9ae04f09ebab9f464c 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -2968,7 +2968,9 @@ size_t SpdyFramer::GetNumberRequiredContinuationFrames(size_t size) {
DCHECK_GT(protocol_version(), SPDY3);
DCHECK_GT(size, kMaxControlFrameSize);
size_t overflow = size - kMaxControlFrameSize;
- return overflow / (kMaxControlFrameSize - GetContinuationMinimumSize()) + 1;
+ size_t payload_size = kMaxControlFrameSize - GetContinuationMinimumSize();
+ // This is ceiling(overflow/payload_size) using integer arithmetics.
+ return (overflow - 1) / payload_size + 1;
Ryan Hamilton 2015/03/09 17:50:08 Looks like this has not yet been fixed in google3'
}
void SpdyFramer::WritePayloadWithContinuation(SpdyFrameBuilder* builder,
« 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