summaryrefslogtreecommitdiff
path: root/gralloc
diff options
context:
space:
mode:
authorraylinhsu <raylinhsu@google.com>2020-04-17 11:27:18 +0800
committerraylinhsu <raylinhsu@google.com>2020-04-21 09:54:12 +0800
commit9c248775d3ac7b409488c7c57309b429731b0290 (patch)
tree205af2096317aca5c25b3432b2321c7fe3aa49ad /gralloc
parent5b0da005fb6eb80e984fe4568bdc30a89c8fd559 (diff)
downloaddisplay-9c248775d3ac7b409488c7c57309b429731b0290.tar.gz
gralloc: Additional buffer validation in getTransportSize
getTransportSize should return BAD_BUFFER for non-imported raw buffers. Bug: 152438363 Test: run vts -m VtsHalGraphicsMapperV2_1TargetTest Change-Id: Ife686b996220df8094216a7e55e66176fe6c3521
Diffstat (limited to 'gralloc')
-rw-r--r--gralloc/QtiMapper.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/gralloc/QtiMapper.cpp b/gralloc/QtiMapper.cpp
index 80655361..ee1d36f0 100644
--- a/gralloc/QtiMapper.cpp
+++ b/gralloc/QtiMapper.cpp
@@ -245,13 +245,15 @@ Return<void> QtiMapper::getTransportSize(void *buffer,
auto err = Error::BAD_BUFFER;
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 (buffer != nullptr && private_handle_t::validate(hnd) == 0 &&
+ buf_mgr_->IsBufferImported(hnd) == Error::NONE) {
num_fds = 2;
// TODO(user): reduce to transported values;
num_ints = static_cast<uint32_t >(hnd->numInts);
err = Error::NONE;
}
- ALOGD_IF(DEBUG, "GetTransportSize: num fds: %d num ints: %d err:%d", num_fds, num_ints, err);
+ ALOGD_IF(DEBUG, "GetTransportSize: num fds: %d num ints: %d IsBufferImported:%d err:%d",
+ num_fds, num_ints, buf_mgr_->IsBufferImported(hnd), err);
hidl_cb(err, num_fds, num_ints);
return Void();
}