arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2507.19015cs.PLcs.LOcs.SE
收藏

Python 类型系统在 ACL2s 中的枚举式嵌入

An Enumerative Embedding of the Python Type System in ACL2s

Samuel Xifaras, Panagiotis Manolios, Andrew T. Walter, William Robertson

AI总结:

本文在 ACL2s 中嵌入 Python 类型系统子集,利用定制 defdata 枚举器生成模糊测试输入,在四个开源仓库上实现约 68% 至 80% 以上覆盖率并发现类型检查器遗漏的问题。

摘要:

Python 是一种高级解释型语言,已在种类广泛的应用中成为行业标准。本文中,我们通过在 ACL2s 中开发 Python 类型系统的一个子集的嵌入,迈出了使用 ACL2s 对 Python 代码进行推理的第一步。我们支持的 Python 类型子集包括许多最常用的类型注解,以及由受支持类型组成的用户自定义类型。我们提供了这些类型的 ACL2s 定义,以及经过定制的 defdata 枚举器,用于提供代码覆盖并识别 Python 程序中的错误。利用该 ACL2s 嵌入,我们可以生成类型实例,随后将其用作 Python 程序模糊测试的输入,从而识别出最先进 Python 类型检查器未能检测到的 Python 代码缺陷。我们在四个开源仓库上评估了这项工作,提取它们的类型信息,并为类型签名属于受支持 Python 类型子集的函数生成模糊测试输入。需要注意的是,我们仅使用函数的类型签名来生成输入,并将函数体视为黑盒。我们测量了代码覆盖率,其范围从约 68% 到超过 80%,并识别出阻碍覆盖率的代码模式,例如复杂的分支条件和外部文件系统依赖。最后,我们讨论了实验结果,并对未来工作提出建议。

英文摘要:

Python is a high-level interpreted language that has become an industry standard in a wide variety of applications. In this paper, we take a first step towards using ACL2s to reason about Python code by developing an embedding of a subset of the Python type system in ACL2s. The subset of Python types we support includes many of the most commonly used type annotations as well as user-defined types comprised of supported types. We provide ACL2s definitions of these types, as well as defdata enumerators that are customized to provide code coverage and identify errors in Python programs. Using the ACL2s embedding, we can generate instances of types that can then be used as inputs to fuzz Python programs, which allows us to identify bugs in Python code that are not detected by state-of-the-art Python type checkers. We evaluate our work against four open-source repositories, extracting their type information and generating inputs for fuzzing functions with type signatures that are in the supported subset of Python types. Note that we only use the type signatures of functions to generate inputs and treat the bodies of functions as black boxes. We measure code coverage, which ranges from about 68% to more than 80%, and identify code patterns that hinder coverage such as complex branch conditions and external file system dependencies. We conclude with a discussion of the results and recommendations for future work.

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

↑