commit | 030aa9f62bb6f3c684224de9a44792d42b0e45f3 | [log] [tgz] |
---|---|---|
author | Sally Qi <sallyqi@google.com> | Fri Sep 01 06:30:02 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Sep 01 06:30:02 2023 +0000 |
tree | f884df6b6afccb1ea98b0e745ee93ec394742bf2 | |
parent | 632a147ec3fb8a1fcf48c4b94bcabab2706d58fb [diff] | |
parent | c2607f782ceab9ffce4e459896294a42973a842a [diff] |
Add binder check for getConsumerName. am: c2607f782c Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/24625637 Change-Id: I0224c3748ffcc6bb0fc59fa86e4ea9b3517969df Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libs/gui/bufferqueue/1.0/H2BGraphicBufferProducer.cpp b/libs/gui/bufferqueue/1.0/H2BGraphicBufferProducer.cpp index f684874..fd8ffe1 100644 --- a/libs/gui/bufferqueue/1.0/H2BGraphicBufferProducer.cpp +++ b/libs/gui/bufferqueue/1.0/H2BGraphicBufferProducer.cpp
@@ -1172,9 +1172,12 @@ String8 H2BGraphicBufferProducer::getConsumerName() const { String8 lName; - mBase->getConsumerName([&lName] (hidl_string const& name) { - lName = name.c_str(); - }); + status_t transStatus = toStatusT( + mBase->getConsumerName([&lName](hidl_string const& name) { lName = name.c_str(); })); + if (transStatus != NO_ERROR) { + ALOGE("getConsumerName failed to transact: %d", transStatus); + return String8("TransactFailed"); + } return lName; }
diff --git a/libs/gui/bufferqueue/2.0/H2BGraphicBufferProducer.cpp b/libs/gui/bufferqueue/2.0/H2BGraphicBufferProducer.cpp index 2f5b73c..ae00a26 100644 --- a/libs/gui/bufferqueue/2.0/H2BGraphicBufferProducer.cpp +++ b/libs/gui/bufferqueue/2.0/H2BGraphicBufferProducer.cpp
@@ -437,6 +437,10 @@ [&bName](hidl_string const& name) { bName = name.c_str(); }); + if (!transResult.isOk()) { + LOG(ERROR) << "getConsumerName: corrupted transaction."; + return String8("TransactFailed"); + } return bName; }