Zichao Wei
Current Organizations / Institutes
The organizations/institutes from the scholar's latest article
Research Subjects
Zichao Wei has a total of 18 co-authors. Here are the top co-authors by number of shared publications:
- Hai Jin
Huazhong University of Science and Technology
4 shared publications - Ming Wen
Huazhong University of Science and Technology, Wuhan, China
4 shared publications - Xiaohu Du
Huazhong University of Science and Technology, Wuhan, China
2 shared publications - Deqing Zou
Huazhong University of Science and Technology
1 shared publication - Haoyu Wang
Huazhong University of Science and Technology, Wuhan, China
1 shared publication - Qiaoxia Liang
College of Resources and Environment, University of Chinese Academy of Sciences, Beijing 100049, China
1 shared publication
Latest Publications
- Open Access
- 1 October 2026
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Software Engineering
- Vol. 3 (ISSTA) , 4495-4518
PatchPorter: LLM-Driven Security Patch Porting via Version Tracing and Context Selection for NPM
Third-Party Libraries are widely used in modern software development, yet their vulnerabilities pose serious security risks. This issue is particularly severe in the NPM ecosystem, where high-risk 1-day vulnerabilities can remain unpatched for extended periods. Although upgrading to the latest patched version is commonly recommended, it often causes major compatibility issues. Patch porting offers an effective solution to this challenge. However, existing patch porting methods are mainly designed for C and have two limitations when applied to NPM. First, they can be brittle in precisely localizing fix locations when substantial semantic gaps exist across versions. Second, they rely on either excessive or insufficient context for patch adaptation, which may introduce redundant information and increase the risk of hallucination. This paper introduces PatchPorter, a method for single-branch security patch porting in NPM that builds on Large Language Models (LLMs). PatchPorter addresses these limitations through two modules. The localization module leverages LLM semantic understanding and code evolution analysis over version histories maintained by version control systems to identify fix locations. The context selection module analyzes patch dependencies to select minimal yet sufficient context around the localized fix location. The selected context is used as input for the LLM to generate the patch. We construct a dataset of 112 NPM vulnerabilities with Proof- of-Concepts for dynamic validation. Experimental results show that PatchPorter significantly surpasses other methods in accuracy, achieving a 26.23% improvement over the best-performing baseline and a 70.59% increase on the most difficult tasks. Its ability to handle various vulnerability types highlights its practical value. Additional results confirm that both of its main modules also outperform alternative approaches.
- 1 October 2026
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Software Engineering
- Vol. 3 (ISSTA) , 4495-4518
Open AccessPatchPorter: LLM-Driven Security Patch Porting via Version Tracing and Context Selection for NPM
Third-Party Libraries are widely used in modern software development, yet their vulnerabilities pose serious security risks. This issue is particularly severe in the NPM ecosystem, where high-risk 1-day vulnerabilities can remain unpatched for extended periods. Although upgrading to the latest patched version is commonly recommended, it often causes major compatibility issues. Patch porting offers an effective solution to this challenge. However, existing patch porting methods are mainly designed for C and have two limitations when applied to NPM. First, they can be brittle in precisely localizing fix locations when substantial semantic gaps exist across versions. Second, they rely on either excessive or insufficient context for patch adaptation, which may introduce redundant information and increase the risk of hallucination. This paper introduces PatchPorter, a method for single-branch security patch porting in NPM that builds on Large Language Models (LLMs). PatchPorter addresses these limitations through two modules. The localization module leverages LLM semantic understanding and code evolution analysis over version histories maintained by version control systems to identify fix locations. The context selection module analyzes patch dependencies to select minimal yet sufficient context around the localized fix location. The selected context is used as input for the LLM to generate the patch. We construct a dataset of 112 NPM vulnerabilities with Proof- of-Concepts for dynamic validation. Experimental results show that PatchPorter significantly surpasses other methods in accuracy, achieving a 26.23% improvement over the best-performing baseline and a 70.59% increase on the most difficult tasks. Its ability to handle various vulnerability types highlights its practical value. Additional results confirm that both of its main modules also outperform alternative approaches.
- Open Access
- 19 August 2025
- Published by MDPI AG in Sustainability
- Vol. 17 (16) , 7472
Assessing the Impact of the Digital Economy on Carbon Emission Reduction: A Test of the Mediation Effect Based on Industrial Agglomeration
As a pivotal engine of global economic growth, the digital economy provides nations with new momentum to achieve carbon neutrality. By driving inter-industry mobility and reallocation of production factors, the digital economy alters industrial agglomeration patterns, which ultimately influence carbon emissions. Understanding the intrinsic mechanisms through which the digital economy affects carbon emissions is therefore critical for both theoretical and practical significance in advancing green and low-carbon development. This study employs panel data from 278 Chinese cities (2011–2020) to investigate the mechanism by which the digital economy affects urban carbon emissions from the perspective of industrial agglomeration. Our findings indicate that the development of the digital economy significantly reduces urban carbon emissions; a one-percentage-point increase in digital economy development leads to a 0.091% decline in carbon emission intensity. Contrary to conventional expectations, however, higher levels of industrial agglomeration do not contribute to carbon reduction. Mediation analysis reveals that the digital economy enhances industrial agglomeration, which in turn weakens its direct carbon mitigation effect by approximately 6%. Furthermore, the impact varies across regions, city sizes, and industry sectors. These insights offer valuable policy implications for China’s digital transformation, industrial agglomeration optimization, and energy-saving strategies to achieve its dual carbon goals.
- 19 August 2025
- Published by MDPI AG in Sustainability
- Vol. 17 (16) , 7472
Open AccessAssessing the Impact of the Digital Economy on Carbon Emission Reduction: A Test of the Mediation Effect Based on Industrial Agglomeration
As a pivotal engine of global economic growth, the digital economy provides nations with new momentum to achieve carbon neutrality. By driving inter-industry mobility and reallocation of production factors, the digital economy alters industrial agglomeration patterns, which ultimately influence carbon emissions. Understanding the intrinsic mechanisms through which the digital economy affects carbon emissions is therefore critical for both theoretical and practical significance in advancing green and low-carbon development. This study employs panel data from 278 Chinese cities (2011–2020) to investigate the mechanism by which the digital economy affects urban carbon emissions from the perspective of industrial agglomeration. Our findings indicate that the development of the digital economy significantly reduces urban carbon emissions; a one-percentage-point increase in digital economy development leads to a 0.091% decline in carbon emission intensity. Contrary to conventional expectations, however, higher levels of industrial agglomeration do not contribute to carbon reduction. Mediation analysis reveals that the digital economy enhances industrial agglomeration, which in turn weakens its direct carbon mitigation effect by approximately 6%. Furthermore, the impact varies across regions, city sizes, and industry sectors. These insights offer valuable policy implications for China’s digital transformation, industrial agglomeration optimization, and energy-saving strategies to achieve its dual carbon goals.
- Open Access
- 19 June 2025
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Software Engineering
- Vol. 2 (FSE) , 3009-3032
Statement-Level Adversarial Attack on Vulnerability Detection Models via Out-of-Distribution Features
Code vulnerability detection is crucial to ensure software security. Recent advancements, particularly with the emergence of Code Pre-Trained Models (CodePTMs) and Large Language Models (LLMs), have led to significant progress in this area. However, these models are easily susceptible to adversarial attacks, where even slight input modifications can lead the models to generate opposite results. Existing adversarial approaches, such as identifier replacement, code transformation, and dead code insertion, demonstrate promising performance but still face several limitations. First, the perturbations applied to the target code are relatively constrained (e.g., identifier replacement can only be applied to a small subset of tokens within the entire codebase). Second, the design of perturbed tokens lacks specificity in forcing the model to make incorrect predictions (e.g., they are generated by random selection or context-based prediction). Such limitations lead to the inefficiency and ineffectiveness of existing attacks. To address these issues, we propose SLODA (Statement-level OOD Features driven Adversarial Attack), which introduces two types of out-of-distribution (OOD) features: universal features via code deoptimization and label-specific features extracted from existing mispredicted and adversarial examples. These statement-level OOD features not only expand the perturbation scope, but can also significantly reduce the search space due to their inherently adversarial nature. Moreover, since the OOD features are extracted from existing code and the attack considers the context of the target code, they are more difficult to detect. Our extensive experiments across 15 models demonstrate that SLODA surpasses existing five state-of-the-art approaches in terms of the effectiveness, efficiency, and detection resistance. Furthermore, the adversarial examples generated by SLODA also exhibit promising performance to enhance model robustness.
- 19 June 2025
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Software Engineering
- Vol. 2 (FSE) , 3009-3032
Open AccessStatement-Level Adversarial Attack on Vulnerability Detection Models via Out-of-Distribution Features
Code vulnerability detection is crucial to ensure software security. Recent advancements, particularly with the emergence of Code Pre-Trained Models (CodePTMs) and Large Language Models (LLMs), have led to significant progress in this area. However, these models are easily susceptible to adversarial attacks, where even slight input modifications can lead the models to generate opposite results. Existing adversarial approaches, such as identifier replacement, code transformation, and dead code insertion, demonstrate promising performance but still face several limitations. First, the perturbations applied to the target code are relatively constrained (e.g., identifier replacement can only be applied to a small subset of tokens within the entire codebase). Second, the design of perturbed tokens lacks specificity in forcing the model to make incorrect predictions (e.g., they are generated by random selection or context-based prediction). Such limitations lead to the inefficiency and ineffectiveness of existing attacks. To address these issues, we propose SLODA (Statement-level OOD Features driven Adversarial Attack), which introduces two types of out-of-distribution (OOD) features: universal features via code deoptimization and label-specific features extracted from existing mispredicted and adversarial examples. These statement-level OOD features not only expand the perturbation scope, but can also significantly reduce the search space due to their inherently adversarial nature. Moreover, since the OOD features are extracted from existing code and the attack considers the context of the target code, they are more difficult to detect. Our extensive experiments across 15 models demonstrate that SLODA surpasses existing five state-of-the-art approaches in terms of the effectiveness, efficiency, and detection resistance. Furthermore, the adversarial examples generated by SLODA also exhibit promising performance to enhance model robustness.
- Open Access
- 1 March 2025
- Published by KEAI Publishing in Artificial Intelligence in Agriculture
- Vol. 15 (1) , 67-78
Enhancing citrus surface defects detection: A priori feature guided semantic segmentation model
- 1 March 2025
- Published by KEAI Publishing in Artificial Intelligence in Agriculture
- Vol. 15 (1) , 67-78
Open AccessEnhancing citrus surface defects detection: A priori feature guided semantic segmentation model
- Open Access
- 27 October 2024
- Published by Association for Computing Machinery (ACM)
- p. 1094-1106
Unveiling the Characteristics and Impact of Security Patch Evolution
The number of disclosed vulnerabilities in open-source projects has been increasing steadily over the years, and thus it is important to deploy patches to repair vulnerabilities in a timely manner. However, due to the widespread reuse and customization of open-source software, there are often multiple versions or branches of the same project that co-exist in the ecosystem. Therefore, it is often challenging and tricky to guarantee that an exposed vulnerability can be repaired thoroughly. Driven by this, plenty of 1-day vulnerability analysis tools have been proposed recently, such as function-level vulnerability detection and patch presence test tools. Despite the fact that code evolution is common for open-source projects, existing analysis tools often neglect the important fact that the patched code is also constantly evolving. In this study, we take the first look to systematically investigate the phenomenon of security patch evolution in open-source projects. In particular, we performed extensive experiments on a large-scale dataset containing 1,046 distinct CVEs with 2,633 patches collected from popular open-source projects (e.g., linux, openssl). This study reveals interesting yet important findings with respect to the aspects of patch evolution frequency, patch evolution patterns, and the evolution impact on downstream 1-day vulnerability analysis tools. We believe that this study can shed important light on future researches on patch analysis.
- 27 October 2024
- Published by Association for Computing Machinery (ACM)
- p. 1094-1106
Open AccessUnveiling the Characteristics and Impact of Security Patch Evolution
The number of disclosed vulnerabilities in open-source projects has been increasing steadily over the years, and thus it is important to deploy patches to repair vulnerabilities in a timely manner. However, due to the widespread reuse and customization of open-source software, there are often multiple versions or branches of the same project that co-exist in the ecosystem. Therefore, it is often challenging and tricky to guarantee that an exposed vulnerability can be repaired thoroughly. Driven by this, plenty of 1-day vulnerability analysis tools have been proposed recently, such as function-level vulnerability detection and patch presence test tools. Despite the fact that code evolution is common for open-source projects, existing analysis tools often neglect the important fact that the patched code is also constantly evolving. In this study, we take the first look to systematically investigate the phenomenon of security patch evolution in open-source projects. In particular, we performed extensive experiments on a large-scale dataset containing 1,046 distinct CVEs with 2,633 patches collected from popular open-source projects (e.g., linux, openssl). This study reveals interesting yet important findings with respect to the aspects of patch evolution frequency, patch evolution patterns, and the evolution impact on downstream 1-day vulnerability analysis tools. We believe that this study can shed important light on future researches on patch analysis.
- Open Access
- 30 November 2023
- Published by Association for Computing Machinery (ACM)
- p. 489-501
An Extensive Study on Adversarial Attack against Pre-trained Models of Code
Transformer-based pre-trained models of code (PTMC) have been widely utilized and have achieved state-of-the-art performance in many mission-critical applications. However, they can be vulnerable to adversarial attacks through identifier substitution or coding style transformation, which can significantly degrade accuracy and may further incur security concerns. Although several approaches have been proposed to generate adversarial examples for PTMC, the effectiveness and efficiency of such approaches, especially on different code intelligence tasks, has not been well understood. To bridge this gap, this study systematically analyzes five state-of-the-art adversarial attack approaches from three perspectives: effectiveness, efficiency, and the quality of generated examples. The results show that none of the five approaches balances all these perspectives. Particularly, approaches with a high attack success rate tend to be time-consuming; the adversarial code they generate often lack naturalness, and vice versa. To address this limitation, we explore the impact of perturbing identifiers under different contexts and find that identifier substitution within for and if statements is the most effective. Based on these findings, we propose a new approach that prioritizes different types of statements for various tasks and further utilizes beam search to generate adversarial examples. Evaluation results show that it outperforms the state-of-the-art ALERT in terms of both effectiveness and efficiency while preserving the naturalness of the generated adversarial examples.
- 30 November 2023
- Published by Association for Computing Machinery (ACM)
- p. 489-501
Open AccessAn Extensive Study on Adversarial Attack against Pre-trained Models of Code
Transformer-based pre-trained models of code (PTMC) have been widely utilized and have achieved state-of-the-art performance in many mission-critical applications. However, they can be vulnerable to adversarial attacks through identifier substitution or coding style transformation, which can significantly degrade accuracy and may further incur security concerns. Although several approaches have been proposed to generate adversarial examples for PTMC, the effectiveness and efficiency of such approaches, especially on different code intelligence tasks, has not been well understood. To bridge this gap, this study systematically analyzes five state-of-the-art adversarial attack approaches from three perspectives: effectiveness, efficiency, and the quality of generated examples. The results show that none of the five approaches balances all these perspectives. Particularly, approaches with a high attack success rate tend to be time-consuming; the adversarial code they generate often lack naturalness, and vice versa. To address this limitation, we explore the impact of perturbing identifiers under different contexts and find that identifier substitution within for and if statements is the most effective. Based on these findings, we propose a new approach that prioritizes different types of statements for various tasks and further utilizes beam search to generate adversarial examples. Evaluation results show that it outperforms the state-of-the-art ALERT in terms of both effectiveness and efficiency while preserving the naturalness of the generated adversarial examples.