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

Commit 3b85a4e5 authored by Ping Fan's avatar Ping Fan Committed by archer.wu
Browse files

Fix validation logic in TvInputAidlTest

[Description]
Handle validation incorrectly allows empty integer arrays, causing
potential errors.

Bug:348575546

[Test Report]
Test ok

Change-Id: Ie597fecfaa783b050510b11665a03e31ccb8feaf
parent 8e3aaa2f
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -137,15 +137,17 @@ int32_t TvInputAidlTest::getNumNotIn(vector<int32_t>& nums) {
}

bool TvInputAidlTest::isValidHandle(NativeHandle& handle) {
    if (handle.fds.empty()) {
    if (handle.fds.empty() && handle.ints.empty()) {
        return false;
    }
    if (!(handle.fds.empty())) {
        for (size_t i = 0; i < handle.fds.size(); i++) {
            int fd = handle.fds[i].get();
            if (fcntl(fd, F_GETFL) < 0) {
                return false;
            }
        }
    }
    return true;
}