From 40da48bfdf5d2d199aac55891d2f37822cdbee88 Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Wed, 29 Oct 2014 16:47:19 -0700 Subject: [PATCH] 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 --- services/surfaceflinger/SurfaceFlinger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 2e6d2b6cf..067ac69ae 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -546,7 +546,7 @@ bool SurfaceFlinger::authenticateSurfaceTexture( status_t SurfaceFlinger::getDisplayConfigs(const sp& display, Vector* configs) { - if (configs == NULL) { + if ((configs == NULL) || (display.get() == NULL)) { return BAD_VALUE; }