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

Issue 2928693002: [Content verification] Fix a bug for files that are multiple of 4k bytes. (Closed)

Created:
3 years, 6 months ago by lazyboy
Modified:
3 years, 6 months ago
Reviewers:
Devlin
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Content verification] Fix a bug for files that are multiple of 4k bytes. There was an off-by-one error in ContentVerifyJob::FinishBlock, that would try to look beyond the last 4k block if the total file size was multiple of 4k block. The out of bound block would not be returned by hash_reader_->GetHashForBlock, so content verification would always fail. e.g. For an 8k file: FinishBlock() -> for bytes 0-4095 FinishBlock() -> for bytes 4096-8191 Then an additional FinishBlock() from either ContentVerifyJob::DoneReading or ContentVerifyJob::OnHashesReady would get called. Ideally we shouldn't be calling the third FinishBlock() in this case, but because how the code is laid out currently: 1) hash fetching and reading file content to compute hashes in any order, and 2) handling zero byte and deleted files, It is less intrusive to add a bail out in FinishBlock to handle this case. The bug was exposed by https://codereview.chromium.org/2771953003. This CL also adds regression tests. BUG=720597 Test=See bug description for reproduction. Review-Url: https://codereview.chromium.org/2928693002 Cr-Commit-Position: refs/heads/master@{#477751} Committed: https://chromium.googlesource.com/chromium/src/+/2557ca6ae520912f73ff133c4371a45a2cb43161

Patch Set 1 #

Total comments: 4

Patch Set 2 : address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -2 lines) Patch
M extensions/browser/content_verify_job.cc View 1 chunk +7 lines, -2 lines 0 comments Download
M extensions/browser/content_verify_job_unittest.cc View 1 1 chunk +34 lines, -0 lines 0 comments Download
A extensions/test/data/content_hash_fetcher/different_sized_files/README.txt View 1 chunk +15 lines, -0 lines 0 comments Download
A extensions/test/data/content_hash_fetcher/different_sized_files/source.zip View Binary file 0 comments Download

Messages

Total messages: 20 (13 generated)
lazyboy
3 years, 6 months ago (2017-06-07 03:12:50 UTC) #5
Devlin
lgtm https://codereview.chromium.org/2928693002/diff/1/extensions/browser/content_verify_job_unittest.cc File extensions/browser/content_verify_job_unittest.cc (right): https://codereview.chromium.org/2928693002/diff/1/extensions/browser/content_verify_job_unittest.cc#newcode280 extensions/browser/content_verify_job_unittest.cc:280: for (size_t i = 0; i < arraysize(files_to_test); ...
3 years, 6 months ago (2017-06-07 13:27:32 UTC) #9
lazyboy
https://codereview.chromium.org/2928693002/diff/1/extensions/browser/content_verify_job_unittest.cc File extensions/browser/content_verify_job_unittest.cc (right): https://codereview.chromium.org/2928693002/diff/1/extensions/browser/content_verify_job_unittest.cc#newcode280 extensions/browser/content_verify_job_unittest.cc:280: for (size_t i = 0; i < arraysize(files_to_test); ++i) ...
3 years, 6 months ago (2017-06-07 18:54:15 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2928693002/20001
3 years, 6 months ago (2017-06-07 18:55:21 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: win_clang on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_clang/builds/245349)
3 years, 6 months ago (2017-06-07 19:12:55 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2928693002/20001
3 years, 6 months ago (2017-06-07 19:17:27 UTC) #17
commit-bot: I haz the power
3 years, 6 months ago (2017-06-07 20:29:56 UTC) #20
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://chromium.googlesource.com/chromium/src/+/2557ca6ae520912f73ff133c4371...

Powered by Google App Engine
This is Rietveld 408576698