You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Snipe currently detects 19 categories of errors across C and Python, using real-time cross-file semantic analysis powered by Tree-sitter AST parsing and a repo-wide knowledge graph.
C Error Detection
#
Error Code
Name
Severity
What It Detects
Example
1
SNIPE_TYPE_MISMATCH
Cross-file type mismatch
ERROR
extern declaration type doesn't match the canonical definition in another file
core.c: char arr[10]; / main.c: extern int arr[10];
2
SNIPE_TYPE_MISMATCH
Array write type mismatch
ERROR
Assigning a value of the wrong type into a typed array element
char arr[10]; arr[0] = 42; (assigning int to char array)
3
SNIPE_ARRAY_BOUNDS
Array out of bounds
ERROR
Static array index exceeds the declared size (cross-file aware)
int arr[10]; in core.c / arr[12] accessed in main.c
4
SNIPE_SIGNATURE_DRIFT
Function signature drift
ERROR
Function called with wrong number of arguments vs its definition
int add(int a, int b) called as add(1, 2, 3)
5
SNIPE_UNDEFINED_SYMBOL
Undefined function call
WARNING
Calling a function not defined anywhere in the repo or C standard library
my_custom_func(42); when my_custom_func is never defined
6
SNIPE_FORMAT_STRING
Format string argument mismatch
ERROR
Printf-family call has different number of format specifiers (%d, %s, etc.) vs actual arguments
printf("%d %s", 42); (2 specifiers, 1 argument)
7
SNIPE_UNUSED_EXTERN
Unused extern declaration
WARNING
An extern declaration is never referenced anywhere in the file
extern int helper; declared but helper never used
8
SNIPE_UNSAFE_FUNCTION
Unsafe / discouraged function
ERROR or WARNING
Use of C functions that are removed from the standard (ERROR) or discouraged by CERT C (WARNING)
gets(buf) = ERROR / strcpy(dst, src) = WARNING
9
SNIPE_STRUCT_ACCESS
Invalid struct member access
ERROR
Accessing a member that doesn't exist on a struct type
struct Point { int x; int y; }; p.z; — z doesn't exist
Python Error Detection
#
Error Code
Name
Severity
What It Detects
Example
1
SNIPE_TYPE_MISMATCH
Cross-file type mismatch
ERROR
Variable declared with a different type than in another file in the repo
Assigning a value of the wrong type to a type-annotated variable
x: int = "hello" (annotated int, assigned str)
10
SNIPE_ARG_TYPE_MISMATCH
Argument type mismatch
ERROR
Calling a function with arguments whose types don't match parameter annotations
def greet(name: str) called as greet(42) (expected str, got int)
Unsafe C Functions Flagged (SNIPE_UNSAFE_FUNCTION)
Snipe flags 60+ dangerous C functions based on the CERT C Secure Coding Standard. gets() is flagged as ERROR (removed from C11). All others are WARNING (discouraged but still in the standard).
Removed from C Standard (C11+) — ERROR
Function
Reason
Safe Alternative
gets()
Removed in C11 — no bounds checking, guaranteed buffer overflow risk
fgets(buf, size, stdin)
Unsafe String Handling Functions — WARNING
Function
Reason
Safe Alternative
strcpy()
No bounds checking — writes past buffer if source is longer than destination
strncpy() or strlcpy()
strcat()
No bounds checking — concatenation can overflow destination buffer
strncat() or strlcat()
stpcpy()
No bounds checking — same risks as strcpy()
strncpy() or strlcpy()
gets_s()
Annex K optional function — not widely supported, still risky
fgets(buf, size, stdin)
strtok()
Uses internal static state — not thread-safe, modifies input string
strtok_r() (POSIX) or manual parsing
strncpy()
Does not guarantee null-termination if source >= n bytes
strlcpy() or manually null-terminate
strncat()
Easy to misuse — size parameter is remaining space, not total buffer size
strlcat() or compute remaining size carefully
strdup()
No input length limit — untrusted input can cause memory exhaustion
strndup() with a max length
Unsafe Formatted Output Functions — WARNING
Function
Reason
Safe Alternative
sprintf()
No bounds checking — format output can overflow destination buffer
snprintf(buf, size, fmt, ...)
vsprintf()
No bounds checking — variadic format output can overflow buffer
vsnprintf(buf, size, fmt, ap)
Potentially Unsafe Input Functions — WARNING
Function
Reason
Safe Alternative
scanf()
Without field width limits, %s can overflow buffers
fgets() + sscanf(), or %99s
fscanf()
Without field width limits, %s can overflow buffers
fgets() + sscanf() with bounded specifiers
sscanf()
Without field width limits, %s can overflow buffers
Cross-file type mismatch, array write type, return type, assignment type
SNIPE_ARRAY_BOUNDS
ERROR
C, Python
Static array/list index out of bounds
SNIPE_SIGNATURE_DRIFT
ERROR
C, Python
Function call argument count mismatch
SNIPE_UNDEFINED_SYMBOL
WARNING
C, Python
Undefined symbol or function reference
SNIPE_SHADOWED_SYMBOL
WARNING
Python
Local variable shadows module-level variable
SNIPE_FORMAT_STRING
ERROR
C
Printf format specifier vs argument count mismatch
SNIPE_UNUSED_EXTERN
WARNING
C
Extern declaration never used in file
SNIPE_DEAD_IMPORT
WARNING
Python
Imported name never used in file
SNIPE_UNSAFE_FUNCTION
ERROR / WARNING
C
gets() = ERROR (removed from C11); 60+ other functions = WARNING (discouraged by CERT C)
SNIPE_ARG_TYPE_MISMATCH
ERROR
Python
Function argument type vs parameter annotation mismatch
SNIPE_STRUCT_ACCESS
ERROR
C
Non-existent struct member access
Key Features
Cross-file analysis: Errors are detected across file boundaries using a repo-wide symbol knowledge graph.
Live unsaved buffer support: Checks run on unsaved editor content — no need to save files first.
Same-language only: Cross-file checks only compare C-to-C and Python-to-Python (never cross-language).
Smart exclusions: Python builtins (print, len, range, etc.), C standard library functions (printf, malloc, etc.), and common globals are excluded from undefined symbol checks.
Variadic support: Functions with *args/**kwargs (Python) are correctly handled — any argument count is accepted.
Default parameter support: Functions with default values correctly compute minimum and maximum argument counts.
Star import awareness: Files containing from X import * suppress undefined symbol warnings since imported names can't be statically determined.