From fdd88a629922c2db8b658b5039235d1aa749f729 Mon Sep 17 00:00:00 2001 From: Ken Rockot Date: Mon, 23 Apr 2018 18:35:09 +0000 Subject: [PATCH] Fix handle validity check in ChildHistogramFetcherImpl Invalid Mojo shared memory handles can be "successfully" unwrapped to invalid base shared memory handles. This may be a little weird, but that API is going away in favor of unwrapping new base shared memory types anyway. So rather than changing the API behavior, this fixes the check in ChildHistogramFetcherImpl so it doesn't attempt to use an invalid base::SharedMemoryHandle. Bug: 835837 Change-Id: If6f4fd5086547e671e4d86363ede9513adb2c054 Reviewed-on: https://chromium-review.googlesource.com/1024114 Reviewed-by: John Abd-El-Malek Commit-Queue: Ken Rockot Cr-Commit-Position: refs/heads/master@{#552763} --- content/child/child_histogram_fetcher_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/child/child_histogram_fetcher_impl.cc b/content/child/child_histogram_fetcher_impl.cc index 36dbd27bb6fc28..97283203509ede 100644 --- a/content/child/child_histogram_fetcher_impl.cc +++ b/content/child/child_histogram_fetcher_impl.cc @@ -37,7 +37,7 @@ void ChildHistogramFetcherFactoryImpl::CreateFetcher( const MojoResult result = mojo::UnwrapSharedMemoryHandle( std::move(buffer_handle), &memory_handle, &memory_size, nullptr); - if (result == MOJO_RESULT_OK) { + if (result == MOJO_RESULT_OK && memory_handle.IsValid()) { // This message must be received only once. Multiple calls to create a // global allocator will cause a CHECK() failure. base::GlobalHistogramAllocator::CreateWithSharedMemoryHandle(memory_handle,