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: I1a12f43b7c375b9c01998dadd5b658275c733fb2 Acked-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
This commit is contained in:
parent
793fc0e13d
commit
7aa0c47e42
@ -507,6 +507,9 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
|
|||||||
return BAD_VALUE;
|
return BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!display.get())
|
||||||
|
return NAME_NOT_FOUND;
|
||||||
|
|
||||||
int32_t type = NAME_NOT_FOUND;
|
int32_t type = NAME_NOT_FOUND;
|
||||||
for (int i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) {
|
for (int i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) {
|
||||||
if (display == mBuiltinDisplays[i]) {
|
if (display == mBuiltinDisplays[i]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user