1 Star 0 Fork 36

gys/src-secGear

forked from src-openEuler/secGear 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0017-fix-wrong-spelling-and-null-pointer-dereference-issu.patch 2.69 KB
一键复制 编辑 原始数据 按行查看 历史
chenmaodong 提交于 2021-05-20 19:43 . 内容可能含有违规信息
From 9d0ff75bf869574b5f96079cf5494fe11d20f160 Mon Sep 17 00:00:00 2001
From: zgzxx <zhangguangzhi3@huawei.com>
Date: Sat, 20 Mar 2021 17:27:36 +0800
Subject: [PATCH] fix wrong spelling and null pointer dereference issue
diff --git a/tools/codegener/intel/CodeGen.ml b/tools/codegener/intel/CodeGen.ml
index dc43942..d9ccf7c 100644
--- a/tools/codegener/intel/CodeGen.ml
+++ b/tools/codegener/intel/CodeGen.ml
@@ -872,7 +872,11 @@ let gen_func_uproxy (tf: Ast.trusted_func) (idx: int) (ec: enclave_content) =
let sgx_ecall_fn = get_sgx_fname SGX_ECALL tf.Ast.tf_is_switchless in
(* Normal case - do ECALL with marshaling structure*)
- let ecall_with_ms = sprintf "result = enclave->list_ops_node->ops_desc->ops->cc_ecall_enclave( \n\
+ let ecall_with_ms = sprintf "if(!enclave || !enclave->list_ops_node || !enclave->list_ops_node->ops_desc ||\n\
+ \t\t!enclave->list_ops_node->ops_desc->ops || \n\
+ \t\t!enclave->list_ops_node->ops_desc->ops->cc_ecall_enclave)\n\
+ \t\treturn CC_ERROR_BAD_PARAMETERS;
+ result = enclave->list_ops_node->ops_desc->ops->cc_ecall_enclave( \n\
\t\tenclave,\n\
\t\t%d,\n\
\t\tNULL,\n\
@@ -885,7 +889,11 @@ let gen_func_uproxy (tf: Ast.trusted_func) (idx: int) (ec: enclave_content) =
(* Rare case - the trusted function doesn't have parameter nor return value.
* In this situation, no marshaling structure is required - passing in NULL.
*)
- let ecall_null = sprintf "result = enclave->list_ops_node->ops_desc->ops->cc_ecall_enclave( \n\
+ let ecall_null = sprintf "if(!enclave || !enclave->list_ops_node || !enclave->list_ops_node->ops_desc ||\n\
+ \t\t!enclave->list_ops_node->ops_desc->ops || \n\
+ \t\t!enclave->list_ops_node->ops_desc->ops->cc_ecall_enclave)\n\
+ \t\treturn CC_ERROR_BAD_PARAMETERS;
+ result = enclave->list_ops_node->ops_desc->ops->cc_ecall_enclave( \n\
\t\tenclave,\n\
\t\t%d,\n\
\t\tNULL,\n\
diff --git a/tools/codegener/intel/Util.ml b/tools/codegener/intel/Util.ml
index a77637e..9dd22bd 100644
--- a/tools/codegener/intel/Util.ml
+++ b/tools/codegener/intel/Util.ml
@@ -187,7 +187,7 @@ let get_file_path (fname: string) =
try
List.find Sys.file_exists fn_list
with
- Not_found -> failwithf "File not found within search paths or search paths is permisson denied: %s\n" fname
+ Not_found -> failwithf "File not found within search paths or search paths is permission denied: %s\n" fname
(* Get the short name of the given file name.
* ------------------------------------------
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gys66/secGear.git
git@gitee.com:gys66/secGear.git
gys66
secGear
src-secGear
master

搜索帮助