diff options
author | Mathias Agopian <mathias@google.com> | 2010-09-10 14:40:10 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-09-10 14:40:10 -0700 |
commit | 15a9e53fbeaf765bfa6ed795d270e5968b30acb8 (patch) | |
tree | 9ead73c5b85eb910643510b7f0a0cb94c1d6720f | |
parent | ad20ef6be061091a95353fbf71712a3a97618304 (diff) | |
download | msm7k-15a9e53fbeaf765bfa6ed795d270e5968b30acb8.tar.gz |
reject odd widths or heights for YV12 format
Change-Id: I66cbb5fbc20630218947cd41552a95503b58e15e
-rw-r--r-- | libgralloc-qsd8k/gpu.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libgralloc-qsd8k/gpu.cpp b/libgralloc-qsd8k/gpu.cpp index d577f96..90ff445 100644 --- a/libgralloc-qsd8k/gpu.cpp +++ b/libgralloc-qsd8k/gpu.cpp @@ -239,8 +239,12 @@ int gpu_context_t::alloc_impl(int w, int h, int format, int usage, break; case HAL_PIXEL_FORMAT_YV12: + if ((w&1) || (h&1)) { + LOGE("w or h is odd for HAL_PIXEL_FORMAT_YV12"); + return -EINVAL; + } alignedw = ALIGN(w, 16); - alignedh = ALIGN(h, 2); + alignedh = h; size = alignedw*alignedh + (ALIGN(alignedw/2, 16) * (alignedh/2))*2; break; |