paperbot · PL 论文追踪

全部论文 待读 收藏

P2 No strings attached

No Strings Attached:字符串相关缺陷的实证研究
ASE Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering2020匹配度 4/10 · 论文是 JavaScript 字符串缺陷的实证研究,并指出静态分析器几乎无法检测这类缺陷,与静态分析/缺陷检测有间接关联;但不涉及 LLM/Agent、浮点或贝叶斯程序分析,也不是静态分析技术本身的创新。引用 19 inbox
Aryaz Eghbali, Michael Pradel
crossref: 2026-09-12

AI 速览

一句话:首个对 JavaScript 中字符串相关缺陷的根因、后果与修复特征的系统性实证研究。

字符串在程序中承担正则匹配、反射元素名、嵌入他语言代码、拼接输出等多种角色,但开发者在此类代码上的常见错误此前缺乏系统认识,导致重复犯错且工具支持薄弱。本文首次对字符串相关缺陷的根因、后果等性质开展实证研究,系统分析了 JavaScript 中来自多个项目的 204 个字符串缺陷。研究发现:许多错误源于一组反复出现的根因模式,如错误的字符串字面量与正则表达式;后果多样,包括输出错误或预期行为的静默丢失;修复往往只需改动一行,且修复素材多存在于周边代码;这类缺陷遍布应用各部分,包括核心组件;而现有静态分析器几乎无法检出。研究结论可帮助开发者避免常见错误,并指导工具构建者发现与修复此类缺陷。

问题
字符串在正则匹配、反射、代码嵌入与文本生成中无处不在,但开发者在这类代码上易犯的错误缺乏系统认识,导致同一类错误反复出现,且发现与修复支持不足。
方法
对 JavaScript 项目中 204 个字符串相关缺陷进行系统实证研究,人工归纳其根因模式、后果类型、修复所需改动与素材来源、在应用中的分布,并考察现有静态分析器的检出情况。
评估
通过对 204 个真实缺陷的分类统计,发现根因集中于少数可复现模式、修复多只需一行且素材常来自周边代码、缺陷遍布包括核心组件在内的各部分,且现有静态分析器几乎无法检出其中任何一个。
原文摘要(Abstract)

Strings play many roles in programming because they often contain complex and semantically rich information. For example, programmers use strings to filter inputs via regular expression matching, to express the names of program elements accessed through some form of reflection, to embed code written in another formal language, and to assemble textual output produced by a program. The omnipresence of strings leads to a wide range of mistakes that developers may make, yet little is currently known about these mistakes. The lack of knowledge about string-related bugs leads to developers repeating the same mistakes again and again, and to poor support for finding and fixing such bugs. This paper presents the first empirical study of the root causes, consequences, and other properties of string-related bugs. We systematically study 204 string-related bugs in a diverse set of projects written in JavaScript, a language where strings play a particularly important role. Our findings include (i) that many string-related mistakes are caused by a recurring set of root cause patterns, such as incorrect string literals and regular expressions, (ii) that string-related bugs have a diverse set of consequences, including incorrect output or silent omission of expected behavior, (iii) that fixing string-related bugs often requires changing just a single line, with many of the required repair ingredients available in the surrounding code, (iv) that string-related bugs occur across all parts of applications, including the core components, and (v) that almost none of these bugs are detected by existing static analyzers. Our findings not only show the importance and prevalence of string-related bugs, but they help developers to avoid common mistakes and tool builders to tackle the challenge of finding and fixing string-related bugs.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot5897,
  title = {No strings attached},
  author = {Aryaz Eghbali and Michael Pradel},
  booktitle = {ASE},
  year = {2020},
  doi = {10.1145/3324884.3416576}
}