已关闭
【缺陷报告】空指针解引用 - 文件concat_infershape.cpp - 函数ConcatInferShapeCommon - 行号56 #2764
zhangjunkai9创建于 11 天前关闭于 7 天前
陈思
10 天前 评论:
10 天前 评论:
9 天前 将 Nice_try 设为负责人
9 天前 关联了pull request:fix nulllptrDef of concat_infershape
7 天前 关闭了 issue
7 天前 添加了label:resolved


缺陷信息
缺陷描述
函数 ConcatInferShapeCommon 中,第一个输入(index=0)的 GetDynamicInputShape 返回值在第26行做了 OP_CHECK_NULL_WITH_CONTEXT 空指针校验,但循环中 subsequent 输入(relative_index>=1)的 GetDynamicInputShape 返回值 input_i_shape 未做空指针校验,第55行 *input_i_shape 和第56行 input_i_shape->IsScalar() 直接解引用。同函数对 index=0 的校验证明该 API 可能返回 nullptr,对 index>=1 缺少校验属于遗漏。
事实核查
数据流证据
传播路径:
调用链
可达调用链1 起点:
(entry functions)→ 终点:ops::ConcatInferShapeCommon深度:1可达调用链2 起点:
(entry functions)→ 终点:ops::ConcatInferShapeCommon深度:2修复建议
const gert::Shape* input_i_shape = context->GetDynamicInputShape(dynamic_input_idx, relative_index); OP_CHECK_NULL_WITH_CONTEXT(context, input_i_shape);