summaryrefslogtreecommitdiff
path: root/libchrome_tools/patches/Mojo-Check-if-dispatcher-is-null-in-Core-UnwrapPlatf.patch
blob: 28ff13bb6f1836182ebcb64fbf87d91495751f32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 317fd980dd9504d3fe321b53469fee79e3276fed Mon Sep 17 00:00:00 2001
From: Ryo Hashimoto <hashimoto@chromium.org>
Date: Thu, 4 Oct 2018 05:04:22 +0000
Subject: [PATCH] Mojo: Check if dispatcher is null in
 Core::UnwrapPlatformHandle()

The same check is done in other functions in this .cc file.
Do the same thing for UnwrapPlatformHandle().

BUG=891990
TEST=mojo_unittests

Change-Id: I05fe4bfd5edd8ec3fc67aeb9f11879c74fd71dd4
Reviewed-on: https://chromium-review.googlesource.com/c/1260782
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596510}
---
 mojo/core/core.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mojo/core/core.cc b/mojo/core/core.cc
index 8422ec247a40..32ecea3eae55 100644
--- a/mojo/core/core.cc
+++ b/mojo/core/core.cc
@@ -1017,7 +1017,8 @@ MojoResult Core::UnwrapPlatformHandle(
   {
     base::AutoLock lock(handles_->GetLock());
     dispatcher = handles_->GetDispatcher(mojo_handle);
-    if (dispatcher->GetType() != Dispatcher::Type::PLATFORM_HANDLE)
+    if (!dispatcher ||
+        dispatcher->GetType() != Dispatcher::Type::PLATFORM_HANDLE)
       return MOJO_RESULT_INVALID_ARGUMENT;
 
     MojoResult result =
-- 
2.25.0.225.g125e21ebc7-goog