| Index: components/safe_browsing_db/v4_store.h
|
| diff --git a/components/safe_browsing_db/v4_store.h b/components/safe_browsing_db/v4_store.h
|
| index d4559780cae063ccfeae55d8a14f29f33bff8082..457a995eb525ff13d5a4d48cfe3ffec5e0e2b3a5 100644
|
| --- a/components/safe_browsing_db/v4_store.h
|
| +++ b/components/safe_browsing_db/v4_store.h
|
| @@ -246,6 +246,7 @@ class V4Store {
|
| FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestAdditionsWithRiceEncodingSucceeds);
|
| FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestRemovalsWithRiceEncodingSucceeds);
|
| FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestMergeUpdatesFailsChecksum);
|
| + FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestChecksumErrorOnStartup);
|
| friend class V4StoreTest;
|
|
|
| // If |prefix_size| is within expected range, and |raw_hashes_length| is a
|
| @@ -299,8 +300,9 @@ class V4Store {
|
| // Merges the prefix map from the old store (|old_hash_prefix_map|) and the
|
| // update (additions_map) to populate the prefix map for the current store.
|
| // The indices in the |raw_removals| list, which may be NULL, are not merged.
|
| - // The SHA256 checksum of the final list of hash prefixes, in lexographically
|
| - // sorted order, must match |expected_checksum| (if it's not empty).
|
| + // The SHA256 checksum of the final list of hash prefixes, in
|
| + // lexicographically sorted order, must match |expected_checksum| (if it's not
|
| + // empty).
|
| ApplyUpdateResult MergeUpdate(const HashPrefixMap& old_hash_prefix_map,
|
| const HashPrefixMap& additions_map,
|
| const ::google::protobuf::RepeatedField<
|
| @@ -341,6 +343,12 @@ class V4Store {
|
| // for the failure or reports success.
|
| StoreReadResult ReadFromDisk();
|
|
|
| + // Scheduled when reading the store file from disk on startup. When run, it
|
| + // ensures that the checksum of the hash prefixes in lexicographical sorted
|
| + // order matches the expected value. If not, it clears out the contents of
|
| + // the store.
|
| + void VerifyChecksum(const std::string& expected_checksum);
|
| +
|
| // Writes the FULL_UPDATE |response| to disk as a V4StoreFileFormat proto.
|
| StoreWriteResult WriteToDisk(
|
| std::unique_ptr<ListUpdateResponse> response) const;
|
|
|