diff options
author | Subash Chander <subash@codeaurora.org> | 2019-02-14 14:48:37 +0530 |
---|---|---|
committer | Subash Chander <subash@codeaurora.org> | 2019-02-14 15:01:26 +0530 |
commit | a30bc798901c3851ace0ca92ad8bafd7caf261c6 (patch) | |
tree | a6ab7fb6df8fdd8b953144fad3a4570e8e863766 | |
parent | 3b127626e527a46b42d3a7623861628f93555947 (diff) | |
download | android_hardware_qcom_sdm845_display-a30bc798901c3851ace0ca92ad8bafd7caf261c6.tar.gz android_hardware_qcom_sdm845_display-a30bc798901c3851ace0ca92ad8bafd7caf261c6.tar.bz2 android_hardware_qcom_sdm845_display-a30bc798901c3851ace0ca92ad8bafd7caf261c6.zip |
hwc2: Validate bounds check for input parcel.
CRs-Fixed: 2394384
Change-Id: Iba254b3579cd2c258c3cf80fe234a0de7d75e599
-rw-r--r-- | sdm/libs/hwc2/hwc_session_services.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sdm/libs/hwc2/hwc_session_services.cpp b/sdm/libs/hwc2/hwc_session_services.cpp index 90ed00b4..7600fc85 100644 --- a/sdm/libs/hwc2/hwc_session_services.cpp +++ b/sdm/libs/hwc2/hwc_session_services.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -158,7 +158,8 @@ Return<int32_t> HWCSession::configureDynRefeshRate(IDisplayConfig::DisplayDynRef } int32_t HWCSession::GetConfigCount(int disp_id, uint32_t *count) { - if (disp_id < 0) { + if (disp_id < HWC_DISPLAY_PRIMARY || disp_id >= HWC_NUM_DISPLAY_TYPES) { + DLOGE("Invalid display = %d", disp_id); return -EINVAL; } @@ -182,7 +183,8 @@ Return<void> HWCSession::getConfigCount(IDisplayConfig::DisplayType dpy, } int32_t HWCSession::GetActiveConfigIndex(int disp_id, uint32_t *config) { - if (disp_id < 0) { + if (disp_id < HWC_DISPLAY_PRIMARY || disp_id >= HWC_NUM_DISPLAY_TYPES) { + DLOGE("Invalid display = %d", disp_id); return -EINVAL; } @@ -206,7 +208,8 @@ Return<void> HWCSession::getActiveConfig(IDisplayConfig::DisplayType dpy, } int32_t HWCSession::SetActiveConfigIndex(int disp_id, uint32_t config) { - if (disp_id < 0) { + if (disp_id < HWC_DISPLAY_PRIMARY || disp_id >= HWC_NUM_DISPLAY_TYPES) { + DLOGE("Invalid display = %d", disp_id); return -EINVAL; } @@ -295,7 +298,8 @@ Return<void> HWCSession::getPanelBrightness(getPanelBrightness_cb _hidl_cb) { int32_t HWCSession::MinHdcpEncryptionLevelChanged(int disp_id, uint32_t min_enc_level) { DLOGI("Display %d", disp_id); - if (disp_id < 0) { + if (disp_id < HWC_DISPLAY_PRIMARY || disp_id >= HWC_NUM_DISPLAY_TYPES) { + DLOGE("Invalid display = %d", disp_id); return -EINVAL; } @@ -324,7 +328,8 @@ Return<int32_t> HWCSession::refreshScreen() { } int32_t HWCSession::ControlPartialUpdate(int disp_id, bool enable) { - if (disp_id < 0) { + if (disp_id < HWC_DISPLAY_PRIMARY || disp_id >= HWC_NUM_DISPLAY_TYPES) { + DLOGE("Invalid display = %d", disp_id); return -EINVAL; } |