mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Handle portId out of bounds index
Bug: 268631136
Test: m && m android.hardware.tv.cec@1.0-impl && m android.hardware.tv.cec@1.0
Change-Id: I454caf56c309aae9667afd0e58da453002458a80
(cherry picked from commit 588b958ce1)
This commit is contained in:
@@ -278,6 +278,10 @@ Return<void> HdmiCecDefault::enableAudioReturnChannel(int32_t /*portId*/, bool /
|
||||
|
||||
Return<bool> HdmiCecDefault::isConnected(int32_t portId) {
|
||||
uint16_t addr;
|
||||
if (portId < 0 || portId >= mHdmiCecPorts.size()) {
|
||||
LOG(ERROR) << "Port id is out of bounds, portId = " << portId;
|
||||
return false;
|
||||
}
|
||||
int ret = ioctl(mHdmiCecPorts[portId]->mCecFd, CEC_ADAP_G_PHYS_ADDR, &addr);
|
||||
if (ret) {
|
||||
LOG(ERROR) << "Is connected failed, Error = " << strerror(errno);
|
||||
|
||||
Reference in New Issue
Block a user