Skip to content

Commit 34f405f

Browse files
committed
C++: Update test annotations.
1 parent 9cb1c89 commit 34f405f

File tree

1 file changed

+6
-4
lines changed
  • cpp/ql/test/query-tests/Likely Bugs/Format/WrongTypeFormatArguments/Buildless

1 file changed

+6
-4
lines changed

cpp/ql/test/query-tests/Likely Bugs/Format/WrongTypeFormatArguments/Buildless/second.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ void test_size_t() {
1313
printf("%zu", s); // GOOD (we generally permit signedness changes)
1414
printf("%zx", s); // GOOD (we generally permit signedness changes)
1515
printf("%d", s); // BAD [NOT DETECTED]
16-
printf("%ld", s); // BAD [NOT DETECTED]
17-
printf("%lld", s); // BAD [NOT DETECTED]
16+
printf("%ld", s); // DUBIOUS [NOT DETECTED]
17+
printf("%lld", s); // DUBIOUS [NOT DETECTED]
1818
printf("%u", s); // BAD [NOT DETECTED]
1919

2020
char buffer[1024];
@@ -24,7 +24,9 @@ void test_size_t() {
2424
printf("%zu", &buffer[1023] - buffer); // GOOD
2525
printf("%zx", &buffer[1023] - buffer); // GOOD
2626
printf("%d", &buffer[1023] - buffer); // BAD
27-
printf("%ld", &buffer[1023] - buffer); // BAD [NOT DETECTED]
28-
printf("%lld", &buffer[1023] - buffer); // BAD [NOT DETECTED]
27+
printf("%ld", &buffer[1023] - buffer); // DUBIOUS [NOT DETECTED]
28+
printf("%lld", &buffer[1023] - buffer); // DUBIOUS [NOT DETECTED]
2929
printf("%u", &buffer[1023] - buffer); // BAD
30+
// (for the `%ld` and `%lld` cases, the signedness and type sizes match, `%zd` would be most correct
31+
// and robust but the developer may know enough to make this safe)
3032
}

0 commit comments

Comments
 (0)