Code Property Graph Meets Typestate: A Scalable Framework to Behavioral Bug Detection
Abstract
Behavioral bugs caused by incorrect state changes are particularly challenging to identify because they depend on specific code execution paths. While code property graph (CPG) combine multiple code views through abstract syntax trees (AST), their built-in redundancy from syntax details and fixed connection rules make them hard to scale-a major problem when analyzing large software systems. We introduce QVoG, a new framework that improves CPG by combining graphbased code analysis with state behavior checking. Our main innovation lies in simplifying the CPG at the statement level by consolidating control and data flows into meaningful code blocks and optimizing the edges. This approach reduces the graph size by more than 10 times compared to AST-based methods while maintaining accuracy. This lightweight design allows easy integration of state tracking, where we match object lifecycle rules to simplified CPG connections using replaceable patterns. The combination of streamlined graphs and state-aware analysis helps QVoG effectively find difficult-to-identify behavioral bugs, successfully detecting 25 issues (including 17 confirmed cases and 2 official CVE) in real-world projects. Importantly, QVoG analyzes raw source code without requiring compilation and supports projects exceeding 1 million lines of code.
BibTeX
@inproceedings{deng2025code,
author = {Xingjing Deng and Zhengyao Liu and Xitong Zhong and Shuo Hong and Yixin Yang and Xiang Gao and Xuhui Yan and Hailong Sun},
title = {{Code Property Graph Meets Typestate: A Scalable Framework to Behavioral Bug Detection}},
booktitle = {ICSME},
year = {2025},
doi = {10.1109/icsme64153.2025.00019},
}Ask Althea to put this paper to the test.
Loading related content...