Skip to content

Commit a0141af

Browse files
Treehugger RobotGerrit Code Review
authored andcommitted
Merge "lshal: Fix empty hidl_array access." into main
2 parents 80f53f4 + b4cb70d commit a0141af

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cmds/lshal/ListCommand.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,16 +731,17 @@ Status ListCommand::fetchBinderizedEntry(const sp<IServiceManager> &manager,
731731
[hashChain](const auto& ret) { *hashChain = std::move(ret); });
732732
if (!hashRet.isOk()) {
733733
handleError(TRANSACTION_ERROR, "getHashChain failed: " + hashRet.description());
734+
break; // skip getHashChain
734735
}
735736
if (static_cast<size_t>(hashIndex) >= hashChain->size()) {
736737
handleError(BAD_IMPL,
737738
"interfaceChain indicates position " + std::to_string(hashIndex) +
738739
" but getHashChain returns " + std::to_string(hashChain->size()) +
739740
" hashes");
740-
} else {
741-
auto&& hashArray = (*hashChain)[hashIndex];
742-
entry->hash = android::base::HexString(hashArray.data(), hashArray.size());
741+
break; // skip getHashChain
743742
}
743+
auto&& hashArray = (*hashChain)[hashIndex];
744+
entry->hash = android::base::HexString(hashArray.data(), hashArray.size());
744745
} while (0);
745746
if (status == OK) {
746747
entry->serviceStatus = ServiceStatus::ALIVE;

0 commit comments

Comments
 (0)