From 3cc2629b3b4bfc3b5c21a5932a3a2e590e60f98a Mon Sep 17 00:00:00 2001 From: Dmitry Cherkassov Date: Sat, 23 Mar 2013 23:51:22 +0400 Subject: [PATCH] clover: add dynamic_cast results checking down in clSetKernelArgument() code path. Signed-off-by: Dmitry Cherkassov Signed-off-by: Francisco Jerez --- src/gallium/state_trackers/clover/core/kernel.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp index 6fa8bd63453..20dc4ca57dd 100644 --- a/src/gallium/state_trackers/clover/core/kernel.cpp +++ b/src/gallium/state_trackers/clover/core/kernel.cpp @@ -222,6 +222,9 @@ _cl_kernel::global_argument::set(size_t size, const void *value) { throw error(CL_INVALID_ARG_SIZE); obj = dynamic_cast(*(cl_mem *)value); + if (!obj) + throw error(CL_INVALID_MEM_OBJECT); + __set = true; } @@ -286,6 +289,9 @@ _cl_kernel::constant_argument::set(size_t size, const void *value) { throw error(CL_INVALID_ARG_SIZE); obj = dynamic_cast(*(cl_mem *)value); + if (!obj) + throw error(CL_INVALID_MEM_OBJECT); + __set = true; } @@ -316,6 +322,9 @@ _cl_kernel::image_rd_argument::set(size_t size, const void *value) { throw error(CL_INVALID_ARG_SIZE); obj = dynamic_cast(*(cl_mem *)value); + if (!obj) + throw error(CL_INVALID_MEM_OBJECT); + __set = true; } @@ -346,6 +355,9 @@ _cl_kernel::image_wr_argument::set(size_t size, const void *value) { throw error(CL_INVALID_ARG_SIZE); obj = dynamic_cast(*(cl_mem *)value); + if (!obj) + throw error(CL_INVALID_MEM_OBJECT); + __set = true; } -- 2.30.2