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

Unified Diff: components/gcm_driver/crypto/gcm_message_cryptographer.cc

Issue 1828303002: Add static_casts when combining the padding length (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 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: components/gcm_driver/crypto/gcm_message_cryptographer.cc
diff --git a/components/gcm_driver/crypto/gcm_message_cryptographer.cc b/components/gcm_driver/crypto/gcm_message_cryptographer.cc
index b75ce5ffb7c9f8512587e3af3df2b6299b246571..bb89e7e023897fe271a5b79d2c07d5ba665b05d0 100644
--- a/components/gcm_driver/crypto/gcm_message_cryptographer.cc
+++ b/components/gcm_driver/crypto/gcm_message_cryptographer.cc
@@ -170,7 +170,8 @@ bool GCMMessageCryptographer::Decrypt(const base::StringPiece& ciphertext,
// 65535 bytes of padding. Padding bytes must be zero but, since AES-GCM
// authenticates the plaintext, checking and removing padding need not be done
// in constant-time.
- uint16_t padding_length = (decrypted_record[0] << 8) | decrypted_record[1];
+ uint16_t padding_length = (static_cast<uint8_t>(decrypted_record[0]) << 8) |
+ static_cast<uint8_t>(decrypted_record[1]);
decrypted_record.remove_prefix(sizeof(uint16_t));
if (padding_length > decrypted_record.size()) {
« 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