gralloc: Add check for empty input vector in set
This change checks the size of the input vector in SetMetadata().
If the vector is empty, return UNSUPPORTED
CRs-Fixed: 2654200
Change-Id: I81c2d52f3551609e50663d09aec3405d8ed5928d
diff --git a/gralloc/gr_buf_mgr.cpp b/gralloc/gr_buf_mgr.cpp
index b7554b0..0b698ad 100644
--- a/gralloc/gr_buf_mgr.cpp
+++ b/gralloc/gr_buf_mgr.cpp
@@ -1016,6 +1016,10 @@
if (err != 0)
return Error::BAD_BUFFER;
+ if (in.size() == 0) {
+ return Error::UNSUPPORTED;
+ }
+
auto metadata = reinterpret_cast<MetaData_t *>(handle->base_metadata);
switch (metadatatype_value) {