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

Unified Diff: content/browser/service_worker/service_worker_database.cc

Issue 1135743002: Check the size of ResourceRecords in ServiceWorkerDatabase::ReadRegistration() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_database.cc
diff --git a/content/browser/service_worker/service_worker_database.cc b/content/browser/service_worker/service_worker_database.cc
index 5cd3473ebfd88d3f2d7c0b77df7b60cfc80fbf12..b7f4848b0ddaa5b04b9afab4ae8b31ef26cd92c9 100644
--- a/content/browser/service_worker/service_worker_database.cc
+++ b/content/browser/service_worker/service_worker_database.cc
@@ -530,6 +530,10 @@ ServiceWorkerDatabase::Status ServiceWorkerDatabase::ReadRegistration(
if (status != STATUS_OK)
return status;
+ // ResourceRecord must contain the ServiceWorker's main script.
+ if (resources->empty())
+ return ServiceWorkerDatabase::STATUS_ERROR_CORRUPTED;
+
*registration = value;
return STATUS_OK;
}
@@ -575,6 +579,7 @@ ServiceWorkerDatabase::Status ServiceWorkerDatabase::WriteRegistration(
std::vector<int64>* newly_purgeable_resources) {
DCHECK(sequence_checker_.CalledOnValidSequencedThread());
DCHECK(old_registration);
+ DCHECK(!resources.empty());
michaeln 2015/05/08 20:41:08 Should an attempt to write a reg with an empty res
horo 2015/05/11 03:10:20 When WriteRegistration() is called, the registrati
Status status = LazyOpen(true);
old_registration->version_id = kInvalidServiceWorkerVersionId;
if (status != STATUS_OK)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698