mirror of
https://github.com/github/codeql.git
synced 2026-05-04 21:25:44 +02:00
Merge pull request #13699 from MathiasVP/final-config-to-invalid-pointer-deref
C++: Handle call-contexts mismatches in `cpp/invalid-pointer-deref`
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -675,3 +675,18 @@ void test33(unsigned size, unsigned src_pos)
|
||||
xs[dst_pos++] = 0; // GOOD [FALSE POSITIVE]
|
||||
}
|
||||
}
|
||||
|
||||
int* pointer_arithmetic(int *p, int offset) {
|
||||
return p + offset;
|
||||
}
|
||||
|
||||
void test_missing_call_context_1(unsigned size) {
|
||||
int* p = new int[size];
|
||||
int* end = pointer_arithmetic(p, size);
|
||||
}
|
||||
|
||||
void test_missing_call_context_2(unsigned size) {
|
||||
int* p = new int[size];
|
||||
int* end_minus_one = pointer_arithmetic(p, size - 1);
|
||||
*end_minus_one = '0'; // GOOD
|
||||
}
|
||||
Reference in New Issue
Block a user