diff options
| author | 2020-04-21 17:39:34 -0700 | |
|---|---|---|
| committer | 2020-04-22 11:24:30 -0700 | |
| commit | 9a02eda8d5f95d754aa908e66089750183355511 (patch) | |
| tree | 97ebeea93991e0132e090c5fddd45fae92967989 /services/surfaceflinger/RegionSamplingThread.cpp | |
| parent | 9bb4cfb009f1317605e8ff090e0ce930e15d4d40 (diff) | |
Lookup layer handle when registering region sampling listener
We must do this in order to prevent clients from providing a bogus
handle when registering a region sampling listener. Fortunately, this
particular path required a permissions check so it cannot be accessed
from arbitrary apps on unrooted devices. But, we should not allow this
type of memory corruption to be reachable by the system.
Bug: 153467444
Test: libgui_test
Test: Repro steps in the bug no longer reproduce
Change-Id: I883506798574dfd0688371fdb6305cfad9d153fc
Diffstat (limited to 'services/surfaceflinger/RegionSamplingThread.cpp')
| -rw-r--r-- | services/surfaceflinger/RegionSamplingThread.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp index 68cd84f661..19c204cddb 100644 --- a/services/surfaceflinger/RegionSamplingThread.cpp +++ b/services/surfaceflinger/RegionSamplingThread.cpp @@ -199,13 +199,8 @@ RegionSamplingThread::~RegionSamplingThread() { } } -void RegionSamplingThread::addListener(const Rect& samplingArea, const sp<IBinder>& stopLayerHandle, +void RegionSamplingThread::addListener(const Rect& samplingArea, const wp<Layer>& stopLayer, const sp<IRegionSamplingListener>& listener) { - wp<Layer> stopLayer; - if (stopLayerHandle != nullptr && stopLayerHandle->localBinder() != nullptr) { - stopLayer = static_cast<Layer::Handle*>(stopLayerHandle.get())->owner; - } - sp<IBinder> asBinder = IInterface::asBinder(listener); asBinder->linkToDeath(this); std::lock_guard lock(mSamplingMutex); |