Commit 04181130 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Fix nullptr dereference in utility processes

Some utility processes don't have a Service Manager connection.

BUG=715840

Change-Id: Ie6ba83ef9e2b64986a04a301c96764a9fe7c6f7c
Reviewed-on: https://chromium-review.googlesource.com/488463Reviewed-by: default avatarBen Goodger <ben@chromium.org>
Commit-Queue: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#467738}
parent 681fde40
...@@ -247,6 +247,14 @@ void ChromeContentUtilityClient::UtilityThreadStarted() { ...@@ -247,6 +247,14 @@ void ChromeContentUtilityClient::UtilityThreadStarted() {
if (command_line->HasSwitch(switches::kUtilityProcessRunningElevated)) if (command_line->HasSwitch(switches::kUtilityProcessRunningElevated))
utility_process_running_elevated_ = true; utility_process_running_elevated_ = true;
content::ServiceManagerConnection* connection =
content::ChildThread::Get()->GetServiceManagerConnection();
// NOTE: Some utility process instances are not connected to the Service
// Manager. Nothing left to do in that case.
if (!connection)
return;
auto registry = base::MakeUnique<service_manager::BinderRegistry>(); auto registry = base::MakeUnique<service_manager::BinderRegistry>();
#if BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_EXTENSIONS)
extensions::ExtensionsHandler::ExposeInterfacesToBrowser( extensions::ExtensionsHandler::ExposeInterfacesToBrowser(
...@@ -289,10 +297,9 @@ void ChromeContentUtilityClient::UtilityThreadStarted() { ...@@ -289,10 +297,9 @@ void ChromeContentUtilityClient::UtilityThreadStarted() {
base::ThreadTaskRunnerHandle::Get()); base::ThreadTaskRunnerHandle::Get());
#endif #endif
} }
content::ChildThread::Get()
->GetServiceManagerConnection() connection->AddConnectionFilter(
->AddConnectionFilter(base::MakeUnique<content::SimpleConnectionFilter>( base::MakeUnique<content::SimpleConnectionFilter>(std::move(registry)));
std::move(registry)));
} }
bool ChromeContentUtilityClient::OnMessageReceived( bool ChromeContentUtilityClient::OnMessageReceived(
......
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