gralloc: Additional buffer validation in getTransportSize
CRs-Fixed: 2502270
Change-Id: Ia578dc97ea7280c8df11dc10e1a119e6be1b87df
diff --git a/gralloc/QtiMapper.cpp b/gralloc/QtiMapper.cpp
index dba446a..1d687e8 100644
--- a/gralloc/QtiMapper.cpp
+++ b/gralloc/QtiMapper.cpp
@@ -245,6 +245,10 @@
auto hnd = static_cast<private_handle_t *>(buffer);
uint32_t num_fds = 0, num_ints = 0;
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
+ if (buf_mgr_->IsBufferImported(hnd) != Error::NONE) {
+ hidl_cb(err, num_fds, num_ints);
+ return Void();
+ }
num_fds = 2;
// TODO(user): reduce to transported values;
num_ints = static_cast<uint32_t >(hnd->numInts);