[Beignet] [PATCH 1/2] Runtime: fix a null reference bug.

Zhigang Gong zhigang.gong at linux.intel.com
Fri Sep 13 01:55:22 PDT 2013


The image_slice_pitch may be a null pointer. Need to check before refer
it.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/cl_api.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cl_api.c b/src/cl_api.c
index 7078118..f194760 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -2175,7 +2175,8 @@ clEnqueueMapImage(cl_command_queue   command_queue,
   data->origin[0]   = origin[0];  data->origin[1] = origin[1];  data->origin[2] = origin[2];
   data->region[0]   = region[0];  data->region[1] = region[1];  data->region[2] = region[2];
   data->row_pitch   = *image_row_pitch;
-  data->slice_pitch = *image_slice_pitch;
+  if (image_slice_pitch)
+    data->slice_pitch = *image_slice_pitch;
   data->ptr         = ptr;
   data->offset      = offset;
 
-- 
1.7.9.5



More information about the Beignet mailing list