summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaldev Sahu <quic_c_bsahu@quicinc.com>2022-11-11 15:03:25 +0530
committerGuus Sliepen <gsliepen@google.com>2023-04-04 12:55:00 +0000
commitaf82c80bdaf4da86832d31a9c1ca76fe3c123b12 (patch)
tree64dc049b9f04a72347965f3a2285299d6d9169e9
parent58137990bb14cdac7b0e368bc8e3b92081dc2d2a (diff)
downloaddisplay-android13-qpr3-c-s5-release.tar.gz
Instead of metadata reserved_size, use handle reserved size while import as metadata reserved size can be modified by client which can cause memory corruption. Bug: 253297595 Change-Id: Iedbb9eea589b56e81e044603c958f0b2c4cb3720 Signed-off-by: Guus Sliepen <gsliepen@google.com>
-rw-r--r--gralloc/gr_buf_mgr.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/gralloc/gr_buf_mgr.cpp b/gralloc/gr_buf_mgr.cpp
index 72b72fb7..61249a98 100644
--- a/gralloc/gr_buf_mgr.cpp
+++ b/gralloc/gr_buf_mgr.cpp
@@ -806,9 +806,8 @@ void BufferManager::RegisterHandleLocked(const private_handle_t *hnd, int ion_ha
auto buffer = std::make_shared<Buffer>(hnd, ion_handle, ion_handle_meta);
if (hnd->base_metadata) {
- auto metadata = reinterpret_cast<MetaData_t *>(hnd->base_metadata);
#ifdef METADATA_V2
- buffer->reserved_size = metadata->reservedSize;
+ buffer->reserved_size = hnd->reserved_size;
if (buffer->reserved_size > 0) {
buffer->reserved_region_ptr =
reinterpret_cast<void *>(hnd->base_metadata + sizeof(MetaData_t));