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

Unified Diff: content/browser/indexed_db/indexed_db_callbacks.cc

Issue 774593004: IndexedDB: Fixed cursor/blob use-after-free bug (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused BlobStorageContext param from CreateBlobData() Created 6 years 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 | content/browser/indexed_db/indexed_db_dispatcher_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/indexed_db_callbacks.cc
diff --git a/content/browser/indexed_db/indexed_db_callbacks.cc b/content/browser/indexed_db/indexed_db_callbacks.cc
index a5aafddd557f3b871f816d978d54706f964de8e6..59d290fd6f651b7dd327cf9993bfb2ec96b4026a 100644
--- a/content/browser/indexed_db/indexed_db_callbacks.cc
+++ b/content/browser/indexed_db/indexed_db_callbacks.cc
@@ -6,7 +6,6 @@
#include <algorithm>
-#include "base/guid.h"
#include "base/metrics/histogram.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
@@ -223,15 +222,10 @@ void IndexedDBCallbacks::OnSuccess(scoped_ptr<IndexedDBConnection> connection,
static std::string CreateBlobData(
const IndexedDBBlobInfo& blob_info,
scoped_refptr<IndexedDBDispatcherHost> dispatcher_host,
- storage::BlobStorageContext* blob_storage_context,
base::TaskRunner* task_runner) {
- std::string uuid = blob_info.uuid();
- if (!uuid.empty()) {
+ if (!blob_info.uuid().empty()) {
// We're sending back a live blob, not a reference into our backing store.
- scoped_ptr<storage::BlobDataHandle> blob_data_handle(
- blob_storage_context->GetBlobDataFromUUID(uuid));
- dispatcher_host->HoldBlobDataHandle(uuid, blob_data_handle.Pass());
- return uuid;
+ return dispatcher_host->HoldBlobData(blob_info);
}
scoped_refptr<ShareableFileReference> shareable_file =
ShareableFileReference::Get(blob_info.file_path());
@@ -243,17 +237,7 @@ static std::string CreateBlobData(
if (!blob_info.release_callback().is_null())
shareable_file->AddFinalReleaseCallback(blob_info.release_callback());
}
-
- uuid = base::GenerateGUID();
- scoped_refptr<storage::BlobData> blob_data = new storage::BlobData(uuid);
- blob_data->set_content_type(base::UTF16ToUTF8(blob_info.type()));
- blob_data->AppendFile(
- blob_info.file_path(), 0, blob_info.size(), blob_info.last_modified());
- scoped_ptr<storage::BlobDataHandle> blob_data_handle(
- blob_storage_context->AddFinishedBlob(blob_data.get()));
- dispatcher_host->HoldBlobDataHandle(uuid, blob_data_handle.Pass());
-
- return uuid;
+ return dispatcher_host->HoldBlobData(blob_info);
}
static bool CreateAllBlobs(
@@ -268,7 +252,6 @@ static bool CreateAllBlobs(
(*blob_or_file_info)[i].uuid =
CreateBlobData(blob_info[i],
dispatcher_host,
- dispatcher_host->blob_storage_context(),
dispatcher_host->Context()->TaskRunner());
}
return true;
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698