通过差分测试发现 XML 文档处理器中的 XPath 错误
Finding XPath Bugs in XML Document Processors via Differential Testing
AI总结:
提出基于差分测试的 XPress 系统,通过生成引用目标节点上下文的 XML 文档和 XPath 查询,有效发现多种 XML 处理器中的逻辑错误。
摘要:
可扩展标记语言(XML)是一种广泛用于数据存储和传输的文件格式。许多 XML 处理器支持 XPath,这是一种支持从 XML 文档中提取元素的查询语言。这些系统可能会受到逻辑错误的影响,这些错误会导致处理器返回不正确的结果。为了解决此类错误,我们提出了一种新方法,并将其实现为一个名为 XPress 的系统。作为测试预言机,XPress 依赖于差分测试,该测试比较多个系统在相同测试输入上的结果,并通过它们输出中的差异来识别错误。作为测试输入,XPress 生成 XML 文档和 XPath 查询。为了生成计算非空结果的有意义的查询,XPress 选择一个所谓的目标节点来指导 XPath 表达式的生成过程。使用目标节点,XPress 生成引用与目标节点相关的现有上下文(例如其标签名和属性)的 XPath 表达式,同时还确保谓词在进一步扩展查询之前评估为真。我们在六个成熟的 XML 处理器上测试了我们的方法:BaseX、eXist-DB、Saxon、PostgreSQL、libXML2 和一个商业数据库系统。我们总共在这些系统中发现了 20 个独特的错误,其中 25 个已由开发者验证,其中 12 个已被修复。XPress 是高效的,因为它在 24 小时内发现了 BaseX 中的 12 个独特错误,速度是朴素随机生成的 2 倍。我们期望我们方法的有效性和简洁性将有助于提高许多 XML 处理器的健壮性。
英文摘要:
Extensible Markup Language (XML) is a widely used file format for data storage and transmission. Many XML processors support XPath, a query language that enables the extraction of elements from XML documents. These systems can be affected by logic bugs, which are bugs that cause the processor to return incorrect results. In order to tackle such bugs, we propose a new approach, which we realized as a system called XPress. As a test oracle, XPress relies on differential testing, which compares the results of multiple systems on the same test input, and identifies bugs through discrepancies in their outputs. As test inputs, XPress generates both XML documents and XPath queries. Aiming to generate meaningful queries that compute non-empty results, XPress selects a so-called targeted node to guide the XPath expression generation process. Using the targeted node, XPress generates XPath expressions that reference existing context related to the targeted node, such as its tag name and attributes, while also guaranteeing that a predicate evaluates to true before further expanding the query. We tested our approach on six mature XML processors, BaseX, eXist-DB, Saxon, PostgreSQL, libXML2, and a commercial database system. In total, we have found 20 unique bugs in these systems, of which 25 have been verified by the developers, and 12 of which have been fixed. XPress is efficient, as it finds 12 unique bugs in BaseX in 24 hours, which is 2x as fast as naive random generation. We expect that the effectiveness and simplicity of our approach will help to improve the robustness of many XML processors.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。