We were including native handle size in our numInts calculations.
Fix this.
BUG=b:
62060380
TEST=gralloc related ASAN errors go away
Change-Id: I9ae66655f9e40d82a9cd3fe91ddca9f300fda911
Reviewed-on: https://chromium-review.googlesource.com/517279
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Luis Hector Chavez <lhchavez@chromium.org>
hnd->base.version = sizeof(hnd->base);
hnd->base.numFds = num_planes;
- hnd->base.numInts = num_ints_handle - num_planes;
+ hnd->base.numInts = handle_data_size - num_planes;
for (size_t p = 0; p < num_planes; p++) {
hnd->fds[p] = drv_bo_get_plane_fd(bo, p);
constexpr uint32_t cros_gralloc_magic = 0xABCDDCBA;
-constexpr uint32_t num_ints_handle = ((sizeof(struct cros_gralloc_handle)) / sizeof(int));
+constexpr uint32_t handle_data_size =
+ ((sizeof(struct cros_gralloc_handle) - offsetof(cros_gralloc_handle, fds[0])) / sizeof(int));
constexpr uint32_t sw_access = GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK;