From a5f80a555ab379546d4f96368b98bbf969229821 Mon Sep 17 00:00:00 2001 From: Namit Solanki Date: Fri, 29 Jul 2016 15:19:44 +0530 Subject: surfaceflinger: Access s3d flags only for valid display ID. - Check if display id is within display ID range. Negative display ids lead to undefined behavior in CTS tests. Change-Id: I2db8caf8d7ac65700e5bc37c180763357cc90aad CRs-Fixed: 1043297 --- services/surfaceflinger/ExSurfaceFlinger/ExHWComposer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/surfaceflinger/ExSurfaceFlinger/ExHWComposer.cpp b/services/surfaceflinger/ExSurfaceFlinger/ExHWComposer.cpp index a993405..92cc1a7 100644 --- a/services/surfaceflinger/ExSurfaceFlinger/ExHWComposer.cpp +++ b/services/surfaceflinger/ExSurfaceFlinger/ExHWComposer.cpp @@ -82,6 +82,9 @@ uint32_t ExHWComposer::getS3DFlag(int disp) const { return 0; } + if (!mHwc || uint32_t(disp) >= MAX_HWC_DISPLAYS || !mAllocatedDisplayIDs.hasBit(disp)) + return 0; + const DisplayData& disp_data(mDisplayData[disp]); for (size_t i=0 ; inumHwLayers-1; i++) { -- cgit v1.1