From b2f68b619061af18e214769720d3715ccc4d9591 Mon Sep 17 00:00:00 2001 From: Naseer Ahmed Date: Mon, 14 Nov 2011 14:43:46 -0800 Subject: [PATCH] copybit: Check for invalid handle Change-Id: I3b0bcb3b464aaa15994add3b2f8d6feea3becc68 --- libcopybit/copybit_c2d.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libcopybit/copybit_c2d.cpp b/libcopybit/copybit_c2d.cpp index 63493d7..88f59de 100644 --- a/libcopybit/copybit_c2d.cpp +++ b/libcopybit/copybit_c2d.cpp @@ -307,6 +307,11 @@ static int set_image(int device_fd, uint32 surfaceId, const struct copybit_image return -EINVAL; } + if(handle == NULL) { + LOGE("%s: invalid handle", __func__); + return -EINVAL; + } + if (handle->gpuaddr == 0) { handle->gpuaddr = c2d_get_gpuaddr(device_fd, handle); if(!handle->gpuaddr) {