[Beignet] [PATCH v2 1/3] add sanity check for Image Region in runtime.

xionghu.luo at intel.com xionghu.luo at intel.com
Tue Apr 19 13:26:38 UTC 2016


From: Luo Xionghu <xionghu.luo at intel.com>

Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
 src/cl_utils.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/cl_utils.h b/src/cl_utils.h
index 311ba2a..0934d5f 100644
--- a/src/cl_utils.h
+++ b/src/cl_utils.h
@@ -177,6 +177,11 @@ do {                                                        \
   } else {                                                  \
     REGION = PREGION;                                       \
   }                                                         \
+  if((REGION[0] == 0)||(REGION[1] == 0)||(REGION[2] == 0))  \
+  {                                                         \
+    err = CL_INVALID_VALUE;                                 \
+    goto error;                                             \
+  }                                                         \
 } while(0)
 
 #define FIXUP_IMAGE_ORIGIN(IMAGE, PREGION, REGION)          \
-- 
2.1.4



More information about the Beignet mailing list