Commit cb9dcd96 authored by dgrogan@chromium.org's avatar dgrogan@chromium.org

Improve IndexedDB IPC message sanitization

Defend against a compromised renderer sending junk to the browser.

BUG=174895


Review URL: https://chromiumcodereview.appspot.com/12208119

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182008 0039d316-1c4b-4281-b951-d872f2087c98
parent 4fd5ecbd
...@@ -475,6 +475,12 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut( ...@@ -475,6 +475,12 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnPut(
scoped_ptr<WebIDBCallbacks> callbacks( scoped_ptr<WebIDBCallbacks> callbacks(
new IndexedDBCallbacks<WebIDBKey>(parent_, params.ipc_thread_id, new IndexedDBCallbacks<WebIDBKey>(parent_, params.ipc_thread_id,
params.ipc_response_id)); params.ipc_response_id));
if (params.index_ids.size() != params.index_keys.size()) {
callbacks->onError(WebIDBDatabaseError(
WebKit::WebIDBDatabaseExceptionUnknownError,
"Malformed IPC message: index_ids.size() != index_keys.size()"));
return;
}
WebVector<unsigned char> value(params.value); WebVector<unsigned char> value(params.value);
int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id); int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id);
...@@ -499,7 +505,15 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetIndexKeys( ...@@ -499,7 +505,15 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetIndexKeys(
if (!database) if (!database)
return; return;
database->setIndexKeys(parent_->HostTransactionId(params.transaction_id), int64 host_transaction_id = parent_->HostTransactionId(params.transaction_id);
if (params.index_ids.size() != params.index_keys.size()) {
database->abort(host_transaction_id, WebIDBDatabaseError(
WebKit::WebIDBDatabaseExceptionUnknownError,
"Malformed IPC message: index_ids.size() != index_keys.size()"));
return;
}
database->setIndexKeys(host_transaction_id,
params.object_store_id, params.object_store_id,
params.primary_key, params.index_ids, params.primary_key, params.index_ids,
params.index_keys); params.index_keys);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment