Summary
Add C and C++ language support. This is critical because AI-generated C/C++ code can have dangerous memory safety issues that other languages don't have.
Unique C/C++ patterns to detect
Security (Memory Safety)
strcpy(), strcat(), sprintf() — buffer overflow
malloc() without free() — memory leaks
scanf("%s", buf) — stack buffer overflow
gets() — always dangerous, removed in C11
memcpy() without size validation
- Use-after-free patterns
- Double-free patterns
- Null pointer dereference
Security (General)
system(), popen() — command injection
- Hardcoded file paths (
/etc/passwd, /tmp/)
- Insecure
rand() — predictable random numbers
setuid without proper checks
Hallucinations
- Non-existent headers (
#include <magic_lib.h>)
- Invented POSIX functions
- Fake Win32 API calls
Logic
- Off-by-one errors in loops
- Uninitialized variables
- Missing return statements
- Integer overflow/underflow
Approach
Since parsing C/C++ AST in Python is complex, consider:
- Pattern-based regex analysis (covers 80% of cases)
- Optional integration with
clang via subprocess for full AST analysis
- Focus on the most dangerous patterns first
Acceptance Criteria
Difficulty
Advanced — C/C++ have complex syntax and dangerous patterns that need careful regex or external tool integration.
Summary
Add C and C++ language support. This is critical because AI-generated C/C++ code can have dangerous memory safety issues that other languages don't have.
Unique C/C++ patterns to detect
Security (Memory Safety)
strcpy(),strcat(),sprintf()— buffer overflowmalloc()withoutfree()— memory leaksscanf("%s", buf)— stack buffer overflowgets()— always dangerous, removed in C11memcpy()without size validationSecurity (General)
system(),popen()— command injection/etc/passwd,/tmp/)rand()— predictable random numberssetuidwithout proper checksHallucinations
#include <magic_lib.h>)Logic
Approach
Since parsing C/C++ AST in Python is complex, consider:
clangvia subprocess for full AST analysisAcceptance Criteria
.c,.h) and C++ files (.cpp,.hpp,.cc) auto-detectedDifficulty
Advanced — C/C++ have complex syntax and dangerous patterns that need careful regex or external tool integration.