gralloc: Add padding byte for YUV 420

YUV 420 buffers have the chroma starting at consecutive bytes
but end at the same byte. This results in the second chroma size
being one byte shorter in size. This isn't a problem for
hardware, however, the gralloc lock_ycbcr API expects to read the
same number of bytes based on the cstride for both chroma
components. This could lead to it accessing memory beyond what is
allocated leading to a crash in the calling process especially
when the size aligns exactly to the page size. Add one byte
padding when allocating YUV buffers to make sure the users of
this gralloc API get enough bytes to read.

Bug: 10787131
Change-Id: Id18e0739f9fdc2c7a4fbe7724be668a989f1a4a1
(cherry picked from commit ca07ffae967e7137fb0d97fb9999a11c09b4a7b5)
1 file changed