File tree Expand file tree Collapse file tree
src/semmle/code/cpp/models/implementations
test/library-tests/dataflow/taint-tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,3 +206,34 @@ class StdSequenceContainerAt extends TaintFunction {
206206 output .isQualifierObject ( )
207207 }
208208}
209+
210+ /**
211+ * The standard vector `emplace` function.
212+ */
213+ class StdVectorEmplace extends TaintFunction {
214+ StdVectorEmplace ( ) { this .hasQualifiedName ( "std" , "vector" , "emplace" ) }
215+
216+ override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
217+ // flow from any parameter except the position iterator to qualifier and return value
218+ // (here we assume taint flow from any constructor parameter to the constructed object)
219+ input .isParameter ( [ 1 .. getNumberOfParameters ( ) - 1 ] ) and
220+ (
221+ output .isQualifierObject ( ) or
222+ output .isReturnValue ( )
223+ )
224+ }
225+ }
226+
227+ /**
228+ * The standard vector `emplace_back` function.
229+ */
230+ class StdVectorEmplaceBack extends TaintFunction {
231+ StdVectorEmplaceBack ( ) { this .hasQualifiedName ( "std" , "vector" , "emplace_back" ) }
232+
233+ override predicate hasTaintFlow ( FunctionInput input , FunctionOutput output ) {
234+ // flow from any parameter to qualifier
235+ // (here we assume taint flow from any constructor parameter to the constructed object)
236+ input .isParameter ( [ 0 .. getNumberOfParameters ( ) - 1 ] ) and
237+ output .isQualifierObject ( )
238+ }
239+ }
Original file line number Diff line number Diff line change 72407240| vector.cpp:491:30:491:32 | call to vector | vector.cpp:498:1:498:1 | v2 | |
72417241| vector.cpp:493:2:493:3 | ref arg v1 | vector.cpp:494:7:494:8 | v1 | |
72427242| vector.cpp:493:2:493:3 | ref arg v1 | vector.cpp:498:1:498:1 | v1 | |
7243+ | vector.cpp:493:18:493:23 | call to source | vector.cpp:493:2:493:3 | ref arg v1 | TAINT |
72437244| vector.cpp:494:7:494:8 | ref arg v1 | vector.cpp:498:1:498:1 | v1 | |
72447245| vector.cpp:496:2:496:3 | ref arg v2 | vector.cpp:497:7:497:8 | v2 | |
72457246| vector.cpp:496:2:496:3 | ref arg v2 | vector.cpp:498:1:498:1 | v2 | |
72487249| vector.cpp:496:13:496:14 | ref arg v2 | vector.cpp:498:1:498:1 | v2 | |
72497250| vector.cpp:496:13:496:14 | v2 | vector.cpp:496:16:496:20 | call to begin | TAINT |
72507251| vector.cpp:496:16:496:20 | call to begin | vector.cpp:496:13:496:22 | call to iterator | TAINT |
7252+ | vector.cpp:496:25:496:30 | call to source | vector.cpp:496:2:496:3 | ref arg v2 | TAINT |
7253+ | vector.cpp:496:25:496:30 | call to source | vector.cpp:496:5:496:11 | call to emplace | TAINT |
72517254| vector.cpp:497:7:497:8 | ref arg v2 | vector.cpp:498:1:498:1 | v2 | |
Original file line number Diff line number Diff line change 668668| vector.cpp:482:8:482:10 | src | vector.cpp:478:21:478:37 | call to source |
669669| vector.cpp:485:8:485:10 | src | vector.cpp:478:21:478:37 | call to source |
670670| vector.cpp:486:8:486:9 | cs | vector.cpp:478:21:478:37 | call to source |
671+ | vector.cpp:494:7:494:8 | v1 | vector.cpp:493:18:493:23 | call to source |
672+ | vector.cpp:497:7:497:8 | v2 | vector.cpp:496:25:496:30 | call to source |
Original file line number Diff line number Diff line change 266266| vector.cpp:450:8:450:10 | vector.cpp:449:11:449:16 | AST only |
267267| vector.cpp:473:8:473:8 | vector.cpp:468:11:468:16 | AST only |
268268| vector.cpp:486:8:486:9 | vector.cpp:478:21:478:37 | AST only |
269+ | vector.cpp:494:7:494:8 | vector.cpp:493:18:493:23 | AST only |
270+ | vector.cpp:497:7:497:8 | vector.cpp:496:25:496:30 | AST only |
You can’t perform that action at this time.
0 commit comments