Bug 1562822 - P1. Return NS_ERROR_FILE_CORRUPTED when Safe Browsing cannot read the header of its database. r=gcp

Differential Revision: https://phabricator.services.mozilla.com/D42613

--HG--
extra : moz-landing-system : lando
This commit is contained in:
dlee 2019-08-21 12:07:44 +00:00
parent 60f201dfd5
commit 22e8951110
2 changed files with 6 additions and 2 deletions

View File

@ -333,7 +333,10 @@ nsresult HashStore::Open(uint32_t aVersion) {
NS_ENSURE_SUCCESS(rv, rv);
rv = ReadHeader();
NS_ENSURE_SUCCESS(rv, rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
LOG(("Failed to read header for %s", mTableName.get()));
return NS_ERROR_FILE_CORRUPTED;
}
rv = SanityCheck(aVersion);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -684,7 +684,8 @@ nsresult LookupCache::LoadFromFile(nsCOMPtr<nsIFile>& aFile) {
Header header;
rv = ReadValue(in, header);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
LOG(("Failed to read header for %s", mTableName.get()));
return NS_ERROR_FILE_CORRUPTED;
}
rv = SanityCheck(header);