From 0ad68c09087b2fab4b1ff2ebc9ed38ea0258794c Mon Sep 17 00:00:00 2001 From: Luo Xionghu Date: Fri, 6 May 2016 00:11:47 +0800 Subject: utest: error handling to avoid null pointer dereference. Signed-off-by: Luo Xionghu Reviewed-by: Yang Rong --- utests/get_cl_info.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'utests/get_cl_info.cpp') diff --git a/utests/get_cl_info.cpp b/utests/get_cl_info.cpp index 25366902..bdd7e0c0 100644 --- a/utests/get_cl_info.cpp +++ b/utests/get_cl_info.cpp @@ -181,9 +181,15 @@ void get_program_info(void) int sz; char *ker_path = (char *)malloc(4096 * sizeof(char)); const char *kiss_path = getenv("OCL_KERNEL_PATH"); + if(!kiss_path) + return; + string line; string source_code; + if(strlen(kiss_path) > 4000) + return; + sprintf(ker_path, "%s/%s", kiss_path, "compiler_if_else.cl"); ifstream in(ker_path); -- cgit v1.2.1