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

Unified Diff: net/spdy/hpack_huffman_table.cc

Issue 759063003: Fix "value possibly truncated" warnings on MSVC, net/spdy/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test tweaks Created 6 years, 1 month 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
Index: net/spdy/hpack_huffman_table.cc
diff --git a/net/spdy/hpack_huffman_table.cc b/net/spdy/hpack_huffman_table.cc
index 9e8f6a1f7830f020d203add1d7b6e10f968bde60..0dd5fc0e14204dc881215bd257f8d265c4e404de 100644
--- a/net/spdy/hpack_huffman_table.cc
+++ b/net/spdy/hpack_huffman_table.cc
@@ -56,10 +56,12 @@ HpackHuffmanTable::~HpackHuffmanTable() {}
bool HpackHuffmanTable::Initialize(const HpackHuffmanSymbol* input_symbols,
size_t symbol_count) {
CHECK(!IsInitialized());
+ if (symbol_count > std::numeric_limits<uint16>::max())
+ return false;
Bence 2014/12/01 18:18:38 Could this be a DCHECK to document requirements?
Peter Kasting 2014/12/02 02:13:55 Changed to a DCHECK and added a note to the declar
std::vector<Symbol> symbols(symbol_count);
// Validate symbol id sequence, and copy into |symbols|.
- for (size_t i = 0; i != symbol_count; i++) {
+ for (uint16 i = 0; i != symbol_count; i++) {
if (i != input_symbols[i].id) {
failed_symbol_id_ = i;
return false;

Powered by Google App Engine
This is Rietveld 408576698