arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.00303cs.SE
收藏

漏洞与补丁的倒推关系:一项实证研究

The Inversive Relationship Between Bugs and Patches: An Empirical Study

Jinhan Kim, Jongchan Park, Shin Yoo

摘要:

软件缺陷是开发人员一直关注的问题,修补这些缺陷需要通过复杂的操作花费相当大的成本。相比之下,引入bug可能是一项毫不费力的工作,因为即使是一个简单的突变也可以很容易地破坏被测程序(PUT)。现有的研究已经考虑了这两个对立的活动在很大程度上分开,要么试图自动生成现实的补丁,以帮助开发人员,或找到现实的错误,以模拟和防止未来的缺陷。尽管它们之间有根本的差异,但是,我们假设当简单地考虑代码更改时,它们在语法上并没有彼此不同。为了系统地研究这一假设,我们研究了补丁和错误提交之间的关系,手动和自动生成,使用聚类和模式分析。一个大规模的实证评估表明,高达70%的补丁和故障可以聚集在一起的词汇模式之间的相似性的基础上,进一步,44%的代码更改可以抽象成相同的变化模式。此外,我们调查是否代码变异工具可以被用作自动程序修复(APR)工具,和APR工具作为代码变异工具。在这两种情况下,突变和APR工具的反向使用可以表现得令人惊讶地好,甚至更好,当与它们最初的预期用途相比时。例如,基于深度学习的APR工具SequenceR发现的89%的补丁也可以通过其反演来发现,即,用错误而不是补丁训练的模型。同样,真正的故障耦合突变体的研究表明,TBar,基于模板的APR工具,可以产生14%和3%以上的故障耦合比传统的突变工具,PIT和主要,分别作为一个突变工具。

英文摘要:

Software bugs pose an ever-present concern for developers, and patching such bugs requires a considerable amount of costs through complex operations. In contrast, introducing bugs can be an effortless job, in that even a simple mutation can easily break the Program Under Test (PUT). Existing research has considered these two opposed activities largely separately, either trying to automatically generate realistic patches to help developers, or to find realistic bugs to simulate and prevent future defects. Despite the fundamental differences between them, however, we hypothesise that they do not syntactically differ from each other when considered simply as code changes. To examine this assumption systematically, we investigate the relationship between patches and buggy commits, both generated manually and automatically, using a clustering and pattern analysis. A large scale empirical evaluation reveals that up to 70% of patches and faults can be clustered together based on the similarity between their lexical patterns; further, 44% of the code changes can be abstracted into the identical change patterns. Moreover, we investigate whether code mutation tools can be used as Automated Program Repair (APR) tools, and APR tools as code mutation tools. In both cases, the inverted use of mutation and APR tools can perform surprisingly well, or even better, when compared to their original, intended uses. For example, 89% of patches found by SequenceR, a deep learning based APR tool, can also be found by its inversion, i.e., a model trained with faults and not patches. Similarly, real fault coupling study of mutants reveals that TBar, a template based APR tool, can generate 14% and 3% more fault couplings than traditional mutation tools, PIT and Major respectively, when used as a mutation tool.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑