File tree Expand file tree Collapse file tree
cpp/ql/test/query-tests/Likely Bugs/Format/WrongTypeFormatArguments/Linux_mixed_word_size Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ | tests_32.cpp:14:16:14:23 | void_ptr | This argument should be of type 'long' but is of type 'void *' |
2+ | tests_32.cpp:15:15:15:15 | l | This argument should be of type 'void *' but is of type 'long' |
3+ | tests_64.cpp:14:16:14:23 | void_ptr | This argument should be of type 'long' but is of type 'void *' |
4+ | tests_64.cpp:15:15:15:15 | l | This argument should be of type 'void *' but is of type 'long' |
Original file line number Diff line number Diff line change 1+ Likely Bugs/Format/WrongTypeFormatArguments.ql
Original file line number Diff line number Diff line change 1+ // semmle-extractor-options: --edg --target --edg linux_i686
2+ /*
3+ * Test for printf in a snapshot that contains multiple word/pointer sizes.
4+ */
5+
6+ int printf (const char * format, ...);
7+
8+ void test_32 ()
9+ {
10+ long l;
11+ void *void_ptr;
12+
13+ printf (" %li" , l); // GOOD
14+ printf (" %li" , void_ptr); // BAD
15+ printf (" %p" , l); // BAD
16+ printf (" %p" , void_ptr); // GOOD
17+ }
Original file line number Diff line number Diff line change 1+ // semmle-extractor-options: --edg --target --edg linux_x86_64
2+ /*
3+ * Test for printf in a snapshot that contains multiple word/pointer sizes.
4+ */
5+
6+ int printf (const char * format, ...);
7+
8+ void test_64 ()
9+ {
10+ long l;
11+ void *void_ptr;
12+
13+ printf (" %li" , l); // GOOD
14+ printf (" %li" , void_ptr); // BAD
15+ printf (" %p" , l); // BAD
16+ printf (" %p" , void_ptr); // GOOD
17+ }
You can’t perform that action at this time.
0 commit comments