clover: validate image_row_pitch and image_slice_pitch in clEnqueueMapImage

v2 (Karol Herbst): remove filling values as it was incorrect.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7069>
This commit is contained in:
Serge Martin 2020-10-11 22:24:26 +02:00 committed by Karol Herbst
parent 1ff4db1935
commit 9583ce04db

View file

@ -838,6 +838,12 @@ clEnqueueMapImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking,
validate_object(q, img, origin, region);
validate_map_flags(img, flags);
if (!row_pitch)
throw error(CL_INVALID_VALUE);
if (img.slice_pitch() && !slice_pitch)
throw error(CL_INVALID_VALUE);
void *map = img.resource_in(q).add_map(q, flags, blocking, origin, region);
auto hev = create<hard_event>(q, CL_COMMAND_MAP_IMAGE, deps);