Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a696f19d authored by Paul Colta's avatar Paul Colta Committed by Paul Colța
Browse files

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 588b958c)
parent 06543485
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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);