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

Unified Diff: net/http2/hpack/decoder/hpack_varint_decoder.h

Issue 2819873002: Avoid overflow on left shift in HpackVarintDecoder::Resume(). (Closed)
Patch Set: Created 3 years, 8 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/http2/hpack/decoder/hpack_varint_decoder.h
diff --git a/net/http2/hpack/decoder/hpack_varint_decoder.h b/net/http2/hpack/decoder/hpack_varint_decoder.h
index b110fad23a983b40b0e7974e56bd43ca9bbf56e1..21d230371a56e94afc43b04f400e245ae44e9f4f 100644
--- a/net/http2/hpack/decoder/hpack_varint_decoder.h
+++ b/net/http2/hpack/decoder/hpack_varint_decoder.h
@@ -95,13 +95,12 @@ class NET_EXPORT_PRIVATE HpackVarintDecoder {
return DecodeStatus::kDecodeInProgress;
}
uint8_t byte = db->DecodeUInt8();
+ if (offset_ == MaxOffset() && byte != 0)
xunjieli 2017/04/17 20:51:34 Can we change this to a while-loop to be more read
+ break;
value_ += (byte & 0x7f) << offset_;
if ((byte & 0x80) == 0) {
- if (offset_ < MaxOffset() || byte == 0) {
- MarkDone();
- return DecodeStatus::kDecodeDone;
- }
- break;
+ MarkDone();
+ return DecodeStatus::kDecodeDone;
}
offset_ += 7;
} while (offset_ <= MaxOffset());
« 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