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

Unified Diff: net/quic/crypto/quic_crypto_server_config.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « net/quic/crypto/p256_key_exchange_nss.cc ('k') | net/quic/crypto/quic_server_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/quic_crypto_server_config.cc
diff --git a/net/quic/crypto/quic_crypto_server_config.cc b/net/quic/crypto/quic_crypto_server_config.cc
index 5a650b6073035455723effdc2cc353d17b806e5b..4623ff53e8b7041cdbbdb14b7e8e3d0ccfbf012f 100644
--- a/net/quic/crypto/quic_crypto_server_config.cc
+++ b/net/quic/crypto/quic_crypto_server_config.cc
@@ -251,9 +251,13 @@ QuicServerConfigProtobuf* QuicCryptoServerConfig::GenerateConfig(
string encoded_public_values;
// First three bytes encode the length of the public value.
- encoded_public_values.push_back(curve25519_public_value.size());
- encoded_public_values.push_back(curve25519_public_value.size() >> 8);
- encoded_public_values.push_back(curve25519_public_value.size() >> 16);
+ DCHECK_LT(curve25519_public_value.size(), (1U << 24));
+ encoded_public_values.push_back(
+ static_cast<char>(curve25519_public_value.size()));
+ encoded_public_values.push_back(
+ static_cast<char>(curve25519_public_value.size() >> 8));
+ encoded_public_values.push_back(
+ static_cast<char>(curve25519_public_value.size() >> 16));
encoded_public_values.append(curve25519_public_value.data(),
curve25519_public_value.size());
@@ -263,9 +267,13 @@ QuicServerConfigProtobuf* QuicCryptoServerConfig::GenerateConfig(
scoped_ptr<P256KeyExchange> p256(P256KeyExchange::New(p256_private_key));
StringPiece p256_public_value = p256->public_value();
- encoded_public_values.push_back(p256_public_value.size());
- encoded_public_values.push_back(p256_public_value.size() >> 8);
- encoded_public_values.push_back(p256_public_value.size() >> 16);
+ DCHECK_LT(p256_public_value.size(), (1U << 24));
+ encoded_public_values.push_back(
+ static_cast<char>(p256_public_value.size()));
+ encoded_public_values.push_back(
+ static_cast<char>(p256_public_value.size() >> 8));
+ encoded_public_values.push_back(
+ static_cast<char>(p256_public_value.size() >> 16));
encoded_public_values.append(p256_public_value.data(),
p256_public_value.size());
}
« no previous file with comments | « net/quic/crypto/p256_key_exchange_nss.cc ('k') | net/quic/crypto/quic_server_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698