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

Unified Diff: content/browser/blob_storage/blob_dispatcher_host.cc

Issue 1913343002: [Blob] Removed crash on race case blob messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whoops, checking url now instead. Created 4 years, 8 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/blob_storage/blob_dispatcher_host.cc
diff --git a/content/browser/blob_storage/blob_dispatcher_host.cc b/content/browser/blob_storage/blob_dispatcher_host.cc
index 9433344e56a0855138733471c1262616e0cef876..4f034d7fcd798dcf25df5201181de645077cbd54 100644
--- a/content/browser/blob_storage/blob_dispatcher_host.cc
+++ b/content/browser/blob_storage/blob_dispatcher_host.cc
@@ -219,26 +219,32 @@ void BlobDispatcherHost::OnCancelBuildingBlob(
void BlobDispatcherHost::OnIncrementBlobRefCount(const std::string& uuid) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
BlobStorageContext* context = this->context();
- if (uuid.empty() || !context->registry().HasEntry(uuid)) {
- UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidReference", BDH_INCREMENT,
- BDH_TRACING_ENUM_LAST);
+ if (uuid.empty()) {
bad_message::ReceivedBadMessage(
this, bad_message::BDH_INVALID_REFCOUNT_OPERATION);
return;
}
+ if (!context->registry().HasEntry(uuid)) {
+ UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidReference", BDH_INCREMENT,
+ BDH_TRACING_ENUM_LAST);
+ return;
+ }
context->IncrementBlobRefCount(uuid);
blobs_inuse_map_[uuid] += 1;
}
void BlobDispatcherHost::OnDecrementBlobRefCount(const std::string& uuid) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- if (uuid.empty() || !IsInUseInHost(uuid)) {
- UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidReference", BDH_DECREMENT,
- BDH_TRACING_ENUM_LAST);
+ if (uuid.empty()) {
bad_message::ReceivedBadMessage(
this, bad_message::BDH_INVALID_REFCOUNT_OPERATION);
return;
}
+ if (!IsInUseInHost(uuid)) {
+ UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidReference", BDH_DECREMENT,
+ BDH_TRACING_ENUM_LAST);
+ return;
+ }
BlobStorageContext* context = this->context();
context->DecrementBlobRefCount(uuid);
blobs_inuse_map_[uuid] -= 1;
@@ -262,25 +268,30 @@ void BlobDispatcherHost::OnRegisterPublicBlobURL(const GURL& public_url,
const std::string& uuid) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
BlobStorageContext* context = this->context();
- if (uuid.empty() || !IsInUseInHost(uuid) ||
- context->registry().IsURLMapped(public_url)) {
- UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidURLRegister", BDH_INCREMENT,
- BDH_TRACING_ENUM_LAST);
+ if (uuid.empty()) {
bad_message::ReceivedBadMessage(this,
bad_message::BDH_INVALID_URL_OPERATION);
return;
}
+ if (!IsInUseInHost(uuid) || context->registry().IsURLMapped(public_url)) {
+ UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidURLRegister", BDH_INCREMENT,
+ BDH_TRACING_ENUM_LAST);
+ return;
+ }
context->RegisterPublicBlobURL(public_url, uuid);
public_blob_urls_.insert(public_url);
}
void BlobDispatcherHost::OnRevokePublicBlobURL(const GURL& public_url) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ if (!public_url.is_valid()) {
+ bad_message::ReceivedBadMessage(this,
+ bad_message::BDH_INVALID_URL_OPERATION);
+ return;
+ }
if (!IsUrlRegisteredInHost(public_url)) {
UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidURLRegister", BDH_DECREMENT,
BDH_TRACING_ENUM_LAST);
- bad_message::ReceivedBadMessage(this,
- bad_message::BDH_INVALID_URL_OPERATION);
return;
}
context()->RevokePublicBlobURL(public_url);
« 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