minigbm: cros_gralloc/buffer: Initialize plane address array
Before we return to userspace, we should clear the output array of
pointer values, so that it doesn't contain some spurious data.
Furthermore, if zero flags are given, the lock method itself
dereferences addr[0] before assigning any value there.
BUG=b:38250067
TEST=android.media.cts.DecoderTest on veyron_minnie
Change-Id: I58284477b3813265188f1714f00b1fb7003ed2a3
Reviewed-on: https://chromium-review.googlesource.com/592987
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
diff --git a/cros_gralloc/cros_gralloc_buffer.cc b/cros_gralloc/cros_gralloc_buffer.cc
index a3d65ab..668fa41 100644
--- a/cros_gralloc/cros_gralloc_buffer.cc
+++ b/cros_gralloc/cros_gralloc_buffer.cc
@@ -46,6 +46,8 @@
int32_t cros_gralloc_buffer::lock(uint64_t flags, uint8_t *addr[DRV_MAX_PLANES])
{
+ memset(addr, 0, DRV_MAX_PLANES * sizeof(*addr));
+
/*
* Gralloc consumers don't support more than one kernel buffer per buffer object yet, so
* just use the first kernel buffer.