From 54cf6108490e98a3dafd234cfbc3f8e66dd0135e Mon Sep 17 00:00:00 2001 From: Baldev Sahu Date: Tue, 30 Jan 2018 17:28:57 +0530 Subject: [PATCH] hwc: Validate input parcel values for few qclient methods Validate values read from input parcel as part of handling of few qclient methods. Change-Id: Icf928f409a5c2ac76a73e95de58cb0ebce9d24d5 --- sdm/libs/hwc/hwc_session.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdm/libs/hwc/hwc_session.cpp b/sdm/libs/hwc/hwc_session.cpp index 8a5bd813..31594408 100644 --- a/sdm/libs/hwc/hwc_session.cpp +++ b/sdm/libs/hwc/hwc_session.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved. +* Copyright (c) 2014 - 2018, 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 @@ -1009,7 +1009,7 @@ android::status_t HWCSession::HandleGetDisplayAttributesForConfig(const android: DisplayPort sdm_disp_port = kPortDefault; int hwc_disp_port = qdutils::DISPLAY_PORT_DEFAULT; - if (dpy > HWC_DISPLAY_VIRTUAL) { + if (dpy < HWC_DISPLAY_PRIMARY || dpy >= HWC_NUM_DISPLAY_TYPES || config < 0) { return android::BAD_VALUE; } @@ -1690,7 +1690,7 @@ android::status_t HWCSession::GetVisibleDisplayRect(const android::Parcel *input android::Parcel *output_parcel) { int dpy = input_parcel->readInt32(); - if (dpy < HWC_DISPLAY_PRIMARY || dpy > HWC_DISPLAY_VIRTUAL) { + if (dpy < HWC_DISPLAY_PRIMARY || dpy >= HWC_NUM_DISPLAY_TYPES) { return android::BAD_VALUE;; }