File tree Expand file tree Collapse file tree 4 files changed +18
-0
lines changed
cpp/ql/test/library-tests/dataflow/taint-tests Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -164,4 +164,10 @@ void test_format() {
164164
165165 auto s2 = std::format (string::source ());
166166 sink (s2); // $ ir MISSING: ast
167+ }
168+
169+ void test (std::format_string s) {
170+ int x = source ();
171+ int y = std::same_signature_as_format_but_different_name (s, x);
172+ sink (y); // $ SPURIOUS: ir
167173}
Original file line number Diff line number Diff line change @@ -451,6 +451,9 @@ WARNING: module 'TaintTracking' has been deprecated and may be removed in future
451451| format.cpp:162:24:162:27 | {} | format.cpp:162:24:162:27 | call to basic_format_string | TAINT |
452452| format.cpp:165:13:165:23 | call to format | format.cpp:166:8:166:9 | s2 | |
453453| format.cpp:165:25:165:38 | call to source | format.cpp:165:25:165:40 | call to basic_format_string | TAINT |
454+ | format.cpp:169:30:169:30 | s | format.cpp:171:60:171:60 | s | |
455+ | format.cpp:170:11:170:16 | call to source | format.cpp:171:63:171:63 | x | |
456+ | format.cpp:171:11:171:58 | call to same_signature_as_format_but_different_name | format.cpp:172:8:172:8 | y | |
454457| map.cpp:21:28:21:28 | call to pair | map.cpp:23:2:23:2 | a | |
455458| map.cpp:21:28:21:28 | call to pair | map.cpp:24:7:24:7 | a | |
456459| map.cpp:21:28:21:28 | call to pair | map.cpp:25:7:25:7 | a | |
Original file line number Diff line number Diff line change @@ -676,4 +676,9 @@ namespace std {
676676 using format_string = basic_format_string<char >; // simplified from `char, std::type_identity_t<Args>...`
677677
678678 template <class ... Args> string format ( format_string fmt, Args&&... args );
679+
680+ // This function has the same signature as `format`, but a different name. It should NOT be able to use
681+ // the model for `format`.
682+ template <typename ... Args>
683+ int same_signature_as_format_but_different_name (format_string, Args &&...args);
679684}
Original file line number Diff line number Diff line change @@ -265,6 +265,8 @@ signatureMatches
265265| stl.h:678:33:678:38 | format | (format_string,Args &&) | | format<Args> | 0 |
266266| stl.h:678:33:678:38 | format | (format_string,Args &&) | | format<Args> | 1 |
267267| stl.h:678:33:678:38 | format | (format_string,Args &&) | | format<Args> | 1 |
268+ | stl.h:683:6:683:48 | same_signature_as_format_but_different_name | (format_string,Args &&) | | format<Args> | 0 |
269+ | stl.h:683:6:683:48 | same_signature_as_format_but_different_name | (format_string,Args &&) | | format<Args> | 1 |
268270getSignatureParameterName
269271| (InputIt,InputIt) | deque | assign<InputIt> | 0 | func:0 |
270272| (InputIt,InputIt) | deque | assign<InputIt> | 1 | func:0 |
@@ -729,6 +731,8 @@ getParameterTypeName
729731| stl.h:678:33:678:38 | format | 0 | format_string |
730732| stl.h:678:33:678:38 | format | 1 | func:0 && |
731733| stl.h:678:33:678:38 | format | 1 | func:0 && |
734+ | stl.h:683:6:683:48 | same_signature_as_format_but_different_name | 0 | format_string |
735+ | stl.h:683:6:683:48 | same_signature_as_format_but_different_name | 1 | func:0 && |
732736| stringstream.cpp:18:6:18:9 | sink | 0 | const basic_ostream> & |
733737| stringstream.cpp:21:6:21:9 | sink | 0 | const basic_istream> & |
734738| stringstream.cpp:24:6:24:9 | sink | 0 | const basic_iostream> & |
You can’t perform that action at this time.
0 commit comments