Skip to content

Commit 201842d

Browse files
committed
C++: Add test with missing flow through 'fopen'.
1 parent 79871aa commit 201842d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

cpp/ql/test/library-tests/dataflow/taint-tests/localTaint.expected

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6584,6 +6584,15 @@ WARNING: module 'TaintTracking' has been deprecated and may be removed in future
65846584
| taint.cpp:767:21:767:24 | ref arg path | taint.cpp:768:8:768:11 | path | |
65856585
| taint.cpp:768:8:768:11 | path | taint.cpp:768:7:768:11 | * ... | |
65866586
| taint.cpp:778:37:778:42 | call to source | taint.cpp:779:7:779:9 | obj | |
6587+
| taint.cpp:785:23:785:28 | source | taint.cpp:785:23:785:28 | source | |
6588+
| taint.cpp:785:23:785:28 | source | taint.cpp:786:18:786:23 | source | |
6589+
| taint.cpp:785:23:785:28 | source | taint.cpp:790:15:790:20 | source | |
6590+
| taint.cpp:786:12:786:16 | call to fopen | taint.cpp:787:7:787:7 | f | |
6591+
| taint.cpp:789:8:789:9 | f2 | taint.cpp:790:11:790:12 | f2 | |
6592+
| taint.cpp:789:8:789:9 | f2 | taint.cpp:791:7:791:8 | f2 | |
6593+
| taint.cpp:790:10:790:12 | ref arg & ... | taint.cpp:790:11:790:12 | f2 [inner post update] | |
6594+
| taint.cpp:790:10:790:12 | ref arg & ... | taint.cpp:791:7:791:8 | f2 | |
6595+
| taint.cpp:790:11:790:12 | f2 | taint.cpp:790:10:790:12 | & ... | |
65876596
| vector.cpp:16:43:16:49 | source1 | vector.cpp:17:26:17:32 | source1 | |
65886597
| vector.cpp:16:43:16:49 | source1 | vector.cpp:31:38:31:44 | source1 | |
65896598
| vector.cpp:17:21:17:33 | call to vector | vector.cpp:19:14:19:14 | v | |

cpp/ql/test/library-tests/dataflow/taint-tests/taint.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,4 +777,16 @@ TaintInheritingContentObject source(bool);
777777
void test_TaintInheritingContent() {
778778
TaintInheritingContentObject obj = source(true);
779779
sink(obj.flowFromObject); // $ ir MISSING: ast
780+
}
781+
782+
FILE* fopen(const char*, const char*);
783+
int fopen_s(FILE** pFile, const char *filename, const char *mode);
784+
785+
void fopen_test(char* source) {
786+
FILE* f = fopen(source, "r");
787+
sink(f); // $ MISSING: ast,ir
788+
789+
FILE* f2;
790+
fopen_s(&f2, source, "r");
791+
sink(f2); // $ ast MISSING: ir
780792
}

0 commit comments

Comments
 (0)