diff options
author | Yohei Yukawa <yukawa@google.com> | 2018-12-09 19:07:17 -0800 |
---|---|---|
committer | Yohei Yukawa <yukawa@google.com> | 2018-12-09 19:07:17 -0800 |
commit | 79e4c6a85e41d0906cc565147a983a1fd3ca9dbe (patch) | |
tree | 6ddeaf289148a2c0313c06fb9ca9928f96931071 /tests/DynamicCodeLoggerIntegrationTests/src/cpp/test_executable.cpp | |
parent | 0c49908a02ed49a4ccea9f10890a710268d8f7bc (diff) |
Make sure IME token verification is done inside a lock
This caller verification needs to be done in an atomic manner. There
is a possible race condition in the following code.
@BinderThread
public boolean doSomething(IBinder imeToken, ...) {
if (!calledWithValidToken(imeToken)) {
return false;
}
// possible race condition here.
synchronized(mMethodMap) {
// actual operations
}
}
Insted, we should check the IME token after taking a lock.
@BinderThread
public boolean doSomething(IBinder imeToken, ...) {
synchronized(mMethodMap) {
if (!calledWithValidTokenLocked(imeToken)) {
return false;
}
// actual operations
}
}
Bug: 34886274
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: Ia128b27de2cf16565c9c3fd40c5ac3be8e4eac42
Diffstat (limited to 'tests/DynamicCodeLoggerIntegrationTests/src/cpp/test_executable.cpp')
0 files changed, 0 insertions, 0 deletions