已关闭
SearchSorted 输入校验安全加固 #2538
zhaowenrui创建于  8月6日关闭于  8月7日
zhaowenrui
zhaowenrui
8月6日 创建

问题描述

SearchSorted 存在输入校验不完整问题:

  1. aclnnSearchSortedsGetWorkspaceSize 在访问 sortedSequence/self/out 前缺少空指针校验,异常输入可能导致空指针访问。
  2. AICPU SearchSorted 在 output dtype 不支持时只记录日志但未返回错误,后续可能调用空 std::function。

修复方案

  • 在 aclnnSearchSortedsGetWorkspaceSize 入口补充 sortedSequence/self/out 空指针检查。
  • AICPU output dtype 不支持时直接返回 KERNEL_STATUS_PARAM_INVALID。

关联 PR

https://gitcode.com/cann/ops-math/merge_requests/4479

验证

  • pre-commit run --files math/search_sorted/op_api/aclnn_searchsorted.cpp math/search_sorted/op_kernel_aicpu/search_sorted_aicpu.cpp
  • bash build.sh --ophost
  • bash build.sh -u --ops=search_sorted --gtest_filter=SearchSorted --ccache=off
  • build/tests/ut/op_kernel_aicpu/math_aicpu_op_kernel_ut --gtest_filter=TEST_SearchSorted_UTest.*
likedislike
陈思
陈思成员
8月6日 评论:
likedislike
CANN-robotCANN-robot成员
8月6日 将 zhaowenrui666 设为负责人
CANN-robotCANN-robot成员
8月7日 关闭了 issue
CANN-robotCANN-robot成员
8月7日 添加了label:resolved