summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjay Dudani <adudani@codeaurora.org>2015-05-03 11:44:55 -0700
committerPatrick Tjin <pattjin@google.com>2015-05-07 13:23:32 -0700
commit4e3e30c2d5a2a6f7dc4ee8696b1ac2a52dffd5dc (patch)
tree270c58cf62c650f29d2c4ef8b84d012d6f591654
parentcbe13ef59b25b6df226c09b9351f0f615bc68dda (diff)
downloadframeworks_native-4e3e30c2d5a2a6f7dc4ee8696b1ac2a52dffd5dc.zip
frameworks_native-4e3e30c2d5a2a6f7dc4ee8696b1ac2a52dffd5dc.tar.gz
frameworks_native-4e3e30c2d5a2a6f7dc4ee8696b1ac2a52dffd5dc.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
-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 c8b36ec..579b39e 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -461,7 +461,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;