mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
CPP: More test cases.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
| printf1.h:74:19:74:22 | C_ST | This argument should be of type 'ssize_t' but is of type 'unsigned long long' |
|
||||
| printf1.h:75:19:75:28 | sizeof(<expr>) | This argument should be of type 'ssize_t' but is of type 'unsigned long long' |
|
||||
| printf1.h:84:23:84:35 | ... - ... | This argument should be of type 'ssize_t' but is of type 'long long' |
|
||||
| printf1.h:130:18:130:18 | 0 | This argument should be of type 'void *' but is of type 'int' |
|
||||
| real_world.h:46:36:46:43 | filename | This argument should be of type 'wchar_t *' but is of type 'char16_t *' |
|
||||
| real_world.h:61:21:61:22 | & ... | This argument should be of type 'int *' but is of type 'short *' |
|
||||
| real_world.h:62:22:62:23 | & ... | This argument should be of type 'short *' but is of type 'int *' |
|
||||
|
||||
@@ -101,3 +101,31 @@ void fun1(unsigned char* a, unsigned char* b) {
|
||||
printf("%td\n", pdt); // GOOD
|
||||
printf("%td\n", a-b); // GOOD
|
||||
}
|
||||
|
||||
typedef wchar_t WCHAR_T; // WCHAR_T -> wchar_t -> int
|
||||
typedef int MYCHAR; // MYCHAR -> int (notably not via the wchar_t typedef)
|
||||
|
||||
void fun2() {
|
||||
wchar_t *myString1;
|
||||
WCHAR_T *myString2;
|
||||
int *myString3;
|
||||
MYCHAR *myString4;
|
||||
|
||||
printf("%S", myString1); // GOOD
|
||||
printf("%S", myString2); // GOOD
|
||||
printf("%S", myString3); // GOOD
|
||||
printf("%S", myString4); // GOOD
|
||||
}
|
||||
|
||||
typedef void *VOIDPTR;
|
||||
typedef int (*FUNPTR)(int);
|
||||
|
||||
void fun3(void *p1, VOIDPTR p2, FUNPTR p3, char *p4)
|
||||
{
|
||||
printf("%p\n", p1); // GOOD
|
||||
printf("%p\n", p2); // GOOD
|
||||
printf("%p\n", p3); // GOOD
|
||||
printf("%p\n", p4); // GOOD
|
||||
printf("%p\n", p4 + 1); // GOOD
|
||||
printf("%p\n", 0); // GOOD [FALSE POSITIVE]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user