paperbot · PL 论文追踪

全部论文 待读 收藏

P2 APICAD: Augmenting API Misuse Detection through Specifications from Code and Documents

APICAD:通过来自代码与文档的规约增强 API 误用检测
ICSE 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE)2023匹配度 4/10 · 论文属于传统静态分析与 API 误用检测,虽结合代码和文档挖掘规约并有工业落地,但未涉及 LLM/Agent 与静态分析的交叉,也不涉及浮点或贝叶斯程序分析,与用户当前追的核心问题匹配度较低。引用 14 inbox
Xiaoke Wang, Lei Zhao
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:结合代码与文档挖掘 API 规约,提升 C/C++ API 误用缺陷检测能力。

使用 API 须遵循其规约,否则可能损害功能并带来安全问题。现有 API 误用检测工具通常从现有代码库挖掘多数用法作为规约,或从自然语言文本中抽取规约;前者依赖代码库质量,后者受文本不规则性限制。本文观察到代码与文档所携带的信息可以互补,提出 APICAD,通过结合代码与文档中的规约来检测 C/C++ 的 API 误用缺陷。方法上,一方面为 API 调用构建上下文,并用基于频率的方法从中挖掘规约;另一方面使用轻量关键词与 NLP 辅助技术从文档中获取规约,最终合并规约用于缺陷检测。实验表明,APICAD 能处理多样的 API 使用语义与不同类型的 API 误用。作者在 Curl、Httpd、OpenSSL 和 Linux 内核中报告 153 个新缺陷,其中 145 个已确认,126 个已应用补丁。

问题
API 使用需遵循规约,但现有误用检测的规约来源单一:代码挖掘依赖代码库质量,文档抽取受文本不规则性限制。
方法
APICAD 为 API 调用构建上下文,用基于频率的方法从代码挖掘规约,同时用轻量关键词和 NLP 辅助技术从文档获取规约,并合并两者用于 C/C++ 缺陷检测。
评估
在 Curl、Httpd、OpenSSL 和 Linux 内核等真实项目上评估,报告 153 个新缺陷,其中 145 个确认、126 个补丁被应用。
原文摘要(Abstract)

Using API should follow its specifications. Otherwise, it can bring security impacts while the functionality is damaged. To detect API misuse, we need to know what its specifications are. In addition to being provided manually, current tools usually mine the majority usage in the existing codebase as specifications, or capture specifications from its relevant texts in human language. However, the former depends on the quality of the codebase itself, while the latter is limited to the irregularity of the text. In this work, we observe that the information carried by code and documents can complement each other. To mitigate the demand for a high-quality codebase and reduce the pressure to capture valid information from texts, we present APICAD to detect API misuse bugs of C/C++ by combining the specifications mined from code and documents. On the one hand, we effectively build the contexts for API invocations and mine specifications from them through a frequency-based method. On the other hand, we acquire the specifications from documents by using lightweight keyword-based and NLP-assisted techniques. Finally, the combined specifications are generated for bug detection. Experiments show that APICAD can handle diverse API usage semantics to deal with different types of API misuse bugs. With the help of APICAD, we report 153 new bugs in Curl, Httpd, OpenSSL and Linux kernel, 145 of which have been confirmed and 126 have applied our patches.

链接与引用

DOI 原文 · DBLP

BibTeX
@inproceedings{WangZ23,
  title = {APICAD: Augmenting API Misuse Detection through Specifications from Code and Documents},
  author = {Xiaoke Wang and Lei Zhao},
  booktitle = {ICSE},
  year = {2023},
  doi = {10.1109/icse48619.2023.00032}
}