diff options
author | Luo Xionghu <xionghu.luo@intel.com> | 2016-05-06 00:11:47 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-05-23 18:07:21 +0800 |
commit | 0ad68c09087b2fab4b1ff2ebc9ed38ea0258794c (patch) | |
tree | f70ad6a3ad08f579dcb587188253e3452b40959f /utests/get_cl_info.cpp | |
parent | d30f395244949742f8a0aad83e8720d3c50f0fe1 (diff) | |
download | beignet-0ad68c09087b2fab4b1ff2ebc9ed38ea0258794c.tar.gz |
utest: error handling to avoid null pointer dereference.
Signed-off-by: Luo Xionghu <xionghu.luo@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests/get_cl_info.cpp')
-rw-r--r-- | utests/get_cl_info.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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); |