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 4e3e30c2d5
)
This commit is contained in:
parent
20f7a6f004
commit
ae569747b6
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user