LLM-Generated C Code Security Improved by Tool-Guided Repair
A novel workflow for analysis and repair integrates compilation diagnostics, CodeQL static analysis, and KLEE symbolic execution, along with the retrieval of previous repair patterns to iteratively enhance C code generated by LLMs. In a study involving 5,000 C programming tasks that included relevant vulnerabilities, baseline models exhibited compilation failure rates as high as 46% and security defect rates reaching 49%. For CodeLlama 7B, the security defect rate improved significantly, decreasing from 49% to 19%, while total CodeQL errors were reduced from 15,088 to 2,463, marking an 83.7% decline. Compilation failures were also minimized for DeepSeek Coder 1.3B. This research is detailed in arXiv:2607.21641.
Key facts
- arXiv:2607.21641
- Workflow uses compilation diagnostics, CodeQL, KLEE, and retrieval
- Evaluated on 5,000 C programming tasks
- Baseline compilation failure rates up to 46%
- Baseline security defect rates up to 49%
- CodeLlama 7B: security defects from 49% to 19%
- CodeLlama 7B: CodeQL errors from 15,088 to 2,463 (83.7%)
- DeepSeek Coder 1.3B compilation failures reduced
Entities
Institutions
- arXiv
- CodeQL
- KLEE
- CodeLlama
- DeepSeek Coder