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

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: Using std::make_pair 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..ac12a15ec75f15762774e4b3e95e0694c2d7bfdc 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"
@@ -225,13 +224,9 @@ static std::string CreateBlobData(
scoped_refptr<IndexedDBDispatcherHost> dispatcher_host,
storage::BlobStorageContext* blob_storage_context,
dgrogan 2014/12/05 01:09:29 Looks like you can ax this parameter.
cmumford 2014/12/05 19:08:09 Done.
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 +238,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(
« 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