summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger
diff options
context:
space:
mode:
authorAjay Dudani <adudani@codeaurora.org>2015-05-03 11:44:55 -0700
committerDan Stoza <stoza@google.com>2015-05-28 14:19:10 -0700
commitae569747b632c2e04bddced4db969b11b5d72612 (patch)
treec1b2acced08f5841787154e9863f1d1576b6bdc9 /services/surfaceflinger
parent20f7a6f004511486a2130030a4694ec2d2983c96 (diff)
downloadframeworks_native-ae569747b632c2e04bddced4db969b11b5d72612.zip
frameworks_native-ae569747b632c2e04bddced4db969b11b5d72612.tar.gz
frameworks_native-ae569747b632c2e04bddced4db969b11b5d72612.tar.bz2
surfaceflinger: Fix range check for getFormat
Fix potential buffer overflow error in getFormat with indices greater than MAX_HWC_DISPLAYS. Change-Id: I5e5b69d8d043e900f5e33ca9a62e94ae5f857b68 (cherry picked from commit 4e3e30c2d5a2a6f7dc4ee8696b1ac2a52dffd5dc)
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 4e1b3ea..02c31ff 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -464,7 +464,7 @@ sp<Fence> HWComposer::getDisplayFence(int disp) const {
}
uint32_t HWComposer::getFormat(int disp) const {
- if (uint32_t(disp)>31 || !mAllocatedDisplayIDs.hasBit(disp)) {
+ if (static_cast<uint32_t>(disp) >= MAX_HWC_DISPLAYS || !mAllocatedDisplayIDs.hasBit(disp)) {
return HAL_PIXEL_FORMAT_RGBA_8888;
} else {
return mDisplayData[disp].format;