diff options
| author | 2024-03-18 14:14:35 -0700 | |
|---|---|---|
| committer | 2024-03-18 14:17:15 -0700 | |
| commit | b4cb70df1b3a1749f3a24cd5636c97fac6cbf993 (patch) | |
| tree | 7a4893d611ee3739147f8fb9f4be1abe0e85ae65 | |
| parent | 30ad90f3ece4796c7493af9cbd6a83ab3d520d55 (diff) | |
lshal: Fix empty hidl_array access.
Fix this error:
Abort message: 'Check failed: bytes != nullptr || len == 0 0x0 32'
This bug is introduced by the change below.
!hashRet.isOk() should have a break; in it like the other error cases.
The change below added this code after the error which used to be
the end of the statement.
Bug: 329190736
Fixes: b670dd7e0c1562db
("lshal: Fix mem invalid access (timeoutIPC callers)")
Test: TH
Change-Id: Iada52b2ca033105962727fcccf651fbb5bdd5736
| -rw-r--r-- | cmds/lshal/ListCommand.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp index 870e8eb846..0c1feb8fec 100644 --- a/cmds/lshal/ListCommand.cpp +++ b/cmds/lshal/ListCommand.cpp @@ -731,16 +731,17 @@ Status ListCommand::fetchBinderizedEntry(const sp<IServiceManager> &manager, [hashChain](const auto& ret) { *hashChain = std::move(ret); }); if (!hashRet.isOk()) { handleError(TRANSACTION_ERROR, "getHashChain failed: " + hashRet.description()); + break; // skip getHashChain } if (static_cast<size_t>(hashIndex) >= hashChain->size()) { handleError(BAD_IMPL, "interfaceChain indicates position " + std::to_string(hashIndex) + " but getHashChain returns " + std::to_string(hashChain->size()) + " hashes"); - } else { - auto&& hashArray = (*hashChain)[hashIndex]; - entry->hash = android::base::HexString(hashArray.data(), hashArray.size()); + break; // skip getHashChain } + auto&& hashArray = (*hashChain)[hashIndex]; + entry->hash = android::base::HexString(hashArray.data(), hashArray.size()); } while (0); if (status == OK) { entry->serviceStatus = ServiceStatus::ALIVE; |