diff options
author | Naseer Ahmed <naseer@codeaurora.org> | 2014-11-03 14:49:23 -0500 |
---|---|---|
committer | Jesse Hall <jessehall@google.com> | 2014-11-03 12:16:18 -0800 |
commit | 7aa0c47e4205c6fca136c38f272d911c25c8a8fa (patch) | |
tree | 121a1180e9797e633ded857f5a4f5949f9e5d5c6 /services | |
parent | 793fc0e13d25bdecda1219999f8be2cb3c121d20 (diff) | |
download | frameworks_native-7aa0c47e4205c6fca136c38f272d911c25c8a8fa.zip frameworks_native-7aa0c47e4205c6fca136c38f272d911c25c8a8fa.tar.gz frameworks_native-7aa0c47e4205c6fca136c38f272d911c25c8a8fa.tar.bz2 |
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>
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index cc47e16..c469627 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -507,6 +507,9 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display, return BAD_VALUE; } + if (!display.get()) + return NAME_NOT_FOUND; + int32_t type = NAME_NOT_FOUND; for (int i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) { if (display == mBuiltinDisplays[i]) { |