codeql-coding-standards
codeql-coding-standards copied to clipboard
`M0-2-1`: Consider expanding to inter-procedural overlapping analysis
Affected rules
-
M0-2-1
Description
The query currently identifies objects using an intra-procedural technique - we only check for equivalence of objects within the same function. We should consider expanding to support analysis across functions.
Example
struct s1 {
int m1[10];
};
struct s2 {
int m1;
struct s1 m2;
};
union u {
struct s1 m1;
struct s2 m2;
};
void overlapping_access(u u1, u u2) {
u1.m2.m2 = u2.m1; // NON_COMPLIANT when called from test
}
void test() {
u1 u;
overlapping_access(u, u)
}