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

Unified Diff: extensions/browser/content_verify_job.cc

Issue 2771953003: Fix content verification code for undreadable and deleted files. (Closed)
Patch Set: . Created 3 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
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..5d59f4a959b3b1365625fc0456e2536981ee5a22 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)
Devlin 2017/03/24 02:01:44 unrelated to this cl, but when can current_hash_by
lazyboy 2017/03/24 18:27:47 Yes I noticed this and didn't want to change it at
return true;
+ if (!current_hash_) {
+ // This happens when we fail to read the resource, compute empty content's
Devlin 2017/03/24 02:01:45 nitty nit: s/,/;||.
lazyboy 2017/03/24 18:27:47 Done.
+ // 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();

Powered by Google App Engine
This is Rietveld 408576698