Index: crypto/encryptor_win.cc |
=================================================================== |
--- crypto/encryptor_win.cc (revision 107404) |
+++ crypto/encryptor_win.cc (working copy) |
@@ -83,8 +83,10 @@ |
bool Encryptor::Encrypt(const base::StringPiece& plaintext, |
std::string* ciphertext) { |
DWORD data_len = plaintext.size(); |
+ DCHECK((data_len > 0u) || (mode_ == CBC)); |
DWORD total_len = data_len + block_size_; |
- CHECK_GT(total_len, data_len); |
+ DCHECK_GT(total_len, 0u); |
+ DCHECK_GT(total_len + 1, data_len); |
Ryan Sleevi
2011/11/01 23:08:59
86, 88, 89 -> CHECK variants
|
// CryptoAPI encrypts/decrypts in place. |
char* ciphertext_data = WriteInto(ciphertext, total_len + 1); |
@@ -105,8 +107,8 @@ |
bool Encryptor::Decrypt(const base::StringPiece& ciphertext, |
std::string* plaintext) { |
DWORD data_len = ciphertext.size(); |
- if (data_len == 0 || (data_len + 1) < data_len) |
- return false; |
+ DCHECK_GT(data_len, 0u); |
+ DCHECK_GT(data_len + 1, data_len); |
Ryan Sleevi
2011/11/01 23:08:59
both of these to CHECK_GT
|
// CryptoAPI encrypts/decrypts in place. |
char* plaintext_data = WriteInto(plaintext, data_len + 1); |