[Mesa-dev] [PATCH] clover: add dynamic_cast results checking down in clSetKernelArgument() code path.
Francisco Jerez
currojerez at riseup.net
Sat Mar 23 18:51:16 PDT 2013
Dmitry Cherkassov <dcherkassov at gmail.com> writes:
> Signed-off-by: Dmitry Cherkassov <dcherkassov at gmail.com>
Thanks, pushed.
> ---
> src/gallium/state_trackers/clover/core/kernel.cpp | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp
> index 6fa8bd6..f664d79 100644
> --- a/src/gallium/state_trackers/clover/core/kernel.cpp
> +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
> @@ -222,6 +222,10 @@ _cl_kernel::global_argument::set(size_t size, const void *value) {
> throw error(CL_INVALID_ARG_SIZE);
>
> obj = dynamic_cast<clover::buffer *>(*(cl_mem *)value);
> +
> + if (!obj)
> + throw error(CL_INVALID_MEM_OBJECT);
> +
> __set = true;
> }
>
> @@ -286,6 +290,10 @@ _cl_kernel::constant_argument::set(size_t size, const void *value) {
> throw error(CL_INVALID_ARG_SIZE);
>
> obj = dynamic_cast<clover::buffer *>(*(cl_mem *)value);
> +
> + if (!obj)
> + throw error(CL_INVALID_MEM_OBJECT);
> +
> __set = true;
> }
>
> @@ -316,6 +324,10 @@ _cl_kernel::image_rd_argument::set(size_t size, const void *value) {
> throw error(CL_INVALID_ARG_SIZE);
>
> obj = dynamic_cast<clover::image *>(*(cl_mem *)value);
> +
> + if (!obj)
> + throw error(CL_INVALID_MEM_OBJECT);
> +
> __set = true;
> }
>
> @@ -346,6 +358,10 @@ _cl_kernel::image_wr_argument::set(size_t size, const void *value) {
> throw error(CL_INVALID_ARG_SIZE);
>
> obj = dynamic_cast<clover::image *>(*(cl_mem *)value);
> +
> + if (!obj)
> + throw error(CL_INVALID_MEM_OBJECT);
> +
> __set = true;
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 229 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130324/8f60f2a5/attachment-0001.pgp>
More information about the mesa-dev
mailing list