From 5844bf9d8269a06c4d8c3132f981d430972f10a9 Mon Sep 17 00:00:00 2001 From: Dima Zavin Date: Wed, 9 Dec 2009 21:13:44 -0800 Subject: [PATCH] gralloc-qsd8k: make sure that we never try to allocatio 0 bytes Change-Id: Ic05b895c09a55d746c737aa0c3356edc511d7c96 Signed-off-by: Dima Zavin --- gralloc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gralloc.cpp b/gralloc.cpp index f1d8f55..9887057 100644 --- a/gralloc.cpp +++ b/gralloc.cpp @@ -386,6 +386,9 @@ static int gralloc_alloc(alloc_device_t* dev, size = alignedw * alignedh * bpp; } + if ((ssize_t)size <= 0) + return -EINVAL; + int err; if (usage & GRALLOC_USAGE_HW_FB) { err = gralloc_alloc_framebuffer(dev, size, usage, pHandle);