Commit 0cb84106 authored by shess@chromium.org's avatar shess@chromium.org

Do not validity check safe-browsing store if not opened.

In case of corruptions, the state of empty_ versus file_ may not be
what was expected.

BUG=124907
TEST=See bug.


Review URL: http://codereview.chromium.org/10211013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133860 0039d316-1c4b-4281-b951-d872f2087c98
parent 0a133c0a
...@@ -244,12 +244,13 @@ bool SafeBrowsingStoreFile::Delete() { ...@@ -244,12 +244,13 @@ bool SafeBrowsingStoreFile::Delete() {
} }
bool SafeBrowsingStoreFile::CheckValidity() { bool SafeBrowsingStoreFile::CheckValidity() {
if (empty_) // The file was either empty or never opened. The empty case is
// presumed not to be invalid. The never-opened case can happen if
// BeginUpdate() fails for any databases, and should already have
// caused the corruption callback to fire.
if (!file_.get())
return true; return true;
// If the file was not empty, it should be open.
DCHECK(file_.get());
if (!FileRewind(file_.get())) if (!FileRewind(file_.get()))
return OnCorruptDatabase(); return OnCorruptDatabase();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment