| Index: crypto/encryptor.cc
|
| diff --git a/crypto/encryptor.cc b/crypto/encryptor.cc
|
| index 763dc2c1cb54764ab2428054f9585616f6decdde..0aa706c9b4c14d017295f90fbc00957df99e9e1e 100644
|
| --- a/crypto/encryptor.cc
|
| +++ b/crypto/encryptor.cc
|
| @@ -88,13 +88,13 @@ bool Encryptor::SetCounter(const base::StringPiece& counter) {
|
| bool Encryptor::GenerateCounterMask(size_t plaintext_len,
|
| uint8* mask,
|
| size_t* mask_len) {
|
| - DCHECK_EQ(CTR, mode_);
|
| - CHECK(mask);
|
| - CHECK(mask_len);
|
| + if (!mask || !mask_len || mode_ != CTR)
|
| + return false;
|
|
|
| const size_t kBlockLength = counter_->GetLengthInBytes();
|
| size_t blocks = (plaintext_len + kBlockLength - 1) / kBlockLength;
|
| - CHECK(blocks);
|
| + if (blocks == 0)
|
| + return false;
|
|
|
| *mask_len = blocks * kBlockLength;
|
|
|
|
|