Skip to content

Commit eed2aee

Browse files
committed
C++: Effect on tests.
1 parent 03922aa commit eed2aee

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
| printf.cpp:33:31:33:37 | test | This argument should be of type 'char *' but is of type 'char16_t *' |
1+
| printf.cpp:39:29:39:35 | test | This argument should be of type 'wchar_t *' but is of type 'char16_t *' |
22
| printf.cpp:45:29:45:35 | test | This argument should be of type 'char *' but is of type 'char16_t *' |
3-
| printf.cpp:52:29:52:35 | test | This argument should be of type 'char16_t *' but is of type 'wchar_t *' |
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
| printf.cpp:15:5:15:12 | swprintf | char | char16_t | char16_t |
2-
| printf.cpp:26:5:26:11 | sprintf | char | char16_t | char16_t |
1+
| printf.cpp:26:5:26:11 | sprintf | char | wchar_t | wchar_t |

cpp/ql/test/query-tests/Likely Bugs/Format/WrongTypeFormatArguments/Linux_two_byte_wprintf/printf.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ int sprintf(char *dest, char *format, ...);
3030
void test1() {
3131
WCHAR string[20];
3232

33-
swprintf(string, u"test %s", u"test"); // BAD: `char16_t` string parameter read as `char` string
33+
swprintf(string, u"test %s", u"test"); // BAD: `char16_t` string parameter read as `char` string [NOT DETECTED]
3434
}
3535

3636
void test2() {
3737
char string[20];
3838

39-
sprintf(string, "test %S", u"test"); // GOOD
39+
sprintf(string, "test %S", u"test"); // GOOD [FALSE POSITIVE]
4040
}
4141

4242
void test3() {
@@ -49,5 +49,5 @@ void test3() {
4949
void test4() {
5050
char string[20];
5151

52-
sprintf(string, "test %S", L"test"); // BAD: `wchar_t` string parameter read as `char16_t` string
52+
sprintf(string, "test %S", L"test"); // BAD: `wchar_t` string parameter read as `char16_t` string [NOT DETECTED]
5353
}

0 commit comments

Comments
 (0)