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

Unified Diff: crypto/encryptor.cc

Issue 8511050: Unify the error checking of crypto::Encryptor and add WARN_UNUSED_RESULT to prevent misuse. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac and linux Created 9 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
Index: crypto/encryptor.cc
diff --git a/crypto/encryptor.cc b/crypto/encryptor.cc
index 763dc2c1cb54764ab2428054f9585616f6decdde..69c8f2c7cb1ba330d8df53220ed348a563a4108f 100644
--- a/crypto/encryptor.cc
+++ b/crypto/encryptor.cc
@@ -94,7 +94,8 @@ bool Encryptor::GenerateCounterMask(size_t plaintext_len,
const size_t kBlockLength = counter_->GetLengthInBytes();
size_t blocks = (plaintext_len + kBlockLength - 1) / kBlockLength;
- CHECK(blocks);
+ if (blocks == 0)
+ return false;
wtc 2011/12/15 02:03:58 Should we also mark the GenerateCounterMask method
Ryan Sleevi 2011/12/15 02:18:16 Yes. It matches the previous CHECK, but empty plai
wtc 2011/12/15 22:04:14 Thanks for the explanation. This is fine.
*mask_len = blocks * kBlockLength;
« no previous file with comments | « crypto/encryptor.h ('k') | crypto/encryptor_mac.cc » ('j') | crypto/encryptor_mac.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698