Index: extensions/browser/content_verify_job.cc |
diff --git a/extensions/browser/content_verify_job.cc b/extensions/browser/content_verify_job.cc |
index e2f9f7eb9c84e0853eed096ae2656c1b6e442d47..8d9ce1aed42333f659e89a9311a3e37ab0e224ba 100644 |
--- a/extensions/browser/content_verify_job.cc |
+++ b/extensions/browser/content_verify_job.cc |
@@ -143,8 +143,13 @@ void ContentVerifyJob::DoneReading() { |
} |
bool ContentVerifyJob::FinishBlock() { |
- if (current_hash_byte_count_ <= 0) |
+ if (!done_reading_ && current_hash_byte_count_ == 0) |
return true; |
+ if (!current_hash_) { |
+ // This happens when we fail to read the resource. Compute empty content's |
+ // hash in this case. |
+ current_hash_ = crypto::SecureHash::Create(crypto::SecureHash::SHA256); |
+ } |
std::string final(crypto::kSHA256Length, 0); |
current_hash_->Finish(base::string_as_array(& final), final.size()); |
current_hash_.reset(); |