sf: Add a NULL check in getDisplayConfigs
Validate the display binder by adding a NULL check in getDisplayConfigs. This will prevent a false match if the caller queries the display configs for an inactive display (whose binder is NULL by default). Without this change we might end up attempting to index the display config array, which is unpopulated for inactive displays, and this will result in a crash. (See getDisplayInfo in SurfaceComposerClient.cpp for an example of this scenario) Change-Id: Ib32a7dc8378d3438df0dba1ecd608bbcfc837717
This commit is contained in:
parent
ffe3e96afe
commit
40da48bfdf
@ -546,7 +546,7 @@ bool SurfaceFlinger::authenticateSurfaceTexture(
|
|||||||
|
|
||||||
status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
|
status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
|
||||||
Vector<DisplayInfo>* configs) {
|
Vector<DisplayInfo>* configs) {
|
||||||
if (configs == NULL) {
|
if ((configs == NULL) || (display.get() == NULL)) {
|
||||||
return BAD_VALUE;
|
return BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user