arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2409.20343cs.SE
收藏

揭秘与评估 Java 反编译中的代码可理解性

Demystifying and Assessing Code Understandability in Java Decompilation

Ruixin Qin, Yifan Xiong, Yifei Lu, Minxue Pan

AI总结:

本文首次实证研究 Java 反编译代码的可理解性,发现其与正确性同等重要且问题更常见,并提出六种代码模式及首个基于 Cognitive Complexity 扩展的评估指标,在数据集上取得 0.88 和 0.86 的宏 F1 分数。

摘要:

反编译是将机器级代码转换为可读源代码的过程,在逆向工程中起着关键作用。鉴于反编译的主要目的是在源代码不可用的场景下促进代码理解,反编译代码的可理解性至关重要。本文提出了首个关于 Java 反编译代码可理解性的实证研究,并得到以下发现:(1)Java 反编译的可理解性被认为与其正确性同等重要,且反编译可理解性问题甚至比反编译失败更常见。(2)与原始源代码相比,Java 反编译器生成的反编译代码片段中有相当比例表现出显著更低或更高的可理解性水平。(3)遗憾的是,Cognitive Complexity 在识别这些在反编译过程中表现出不同可理解性的代码片段时,精确率相对可接受但召回率较低。(4)更糟糕的是,perplexity 在识别此类代码片段时表现出更低的精确率和召回率。受这四项发现的启发,我们进一步提出了六种代码模式和首个用于评估反编译代码可理解性的度量指标。该指标从 Cognitive Complexity 扩展而来,通过对 1287 对源代码片段与对应反编译代码的详尽人工分析,新增了六条规则。该指标还在原始数据集和更新数据集上进行了验证,在原始数据集上取得了令人瞩目的 0.88 的宏 F1 分数,在测试集上取得了 0.86 的宏 F1 分数。

英文摘要:

Decompilation, the process of converting machine-level code into readable source code, plays a critical role in reverse engineering. Given that the main purpose of decompilation is to facilitate code comprehension in scenarios where the source code is unavailable, the understandability of decompiled code is of great importance. In this paper, we propose the first empirical study on the understandability of Java decompiled code and obtained the following findings: (1) Understandability of Java decompilation is considered as important as its correctness, and decompilation understandability issues are even more commonly encountered than decompilation failures. (2) A notable percentage of code snippets decompiled by Java decompilers exhibit significantly lower or higher levels of understandability in comparison to their original source code. (3) Unfortunately, Cognitive Complexity demonstrates relatively acceptable precision while low recall in recognizing these code snippets exhibiting diverse understandability during decompilation. (4) Even worse, perplexity demonstrates lower levels of precision and recall in recognizing such code snippets. Inspired by the four findings, we further proposed six code patterns and the first metric for the assessment of decompiled code understandability. This metric was extended from Cognitive Complexity, with six more rules harvested from an exhaustive manual analysis into 1287 pairs of source code snippets and corresponding decompiled code. This metric was also validated using the original and updated dataset, yielding an impressive macro F1-score of 0.88 on the original dataset, and 0.86 on the test set.

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

↑