Skip to content

Commit 23acc31

Browse files
committed
C++: Add testcases with missing models.
1 parent 12048ae commit 23acc31

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7735,6 +7735,12 @@ WARNING: module 'TaintTracking' has been deprecated and may be removed in future
77357735
| taint.cpp:790:10:790:12 | ref arg & ... | taint.cpp:790:11:790:12 | f2 [inner post update] | |
77367736
| taint.cpp:790:10:790:12 | ref arg & ... | taint.cpp:791:7:791:8 | f2 | |
77377737
| taint.cpp:790:11:790:12 | f2 | taint.cpp:790:10:790:12 | & ... | |
7738+
| taint.cpp:805:12:805:25 | call to SysAllocString | taint.cpp:806:8:806:9 | p1 | |
7739+
| taint.cpp:806:8:806:9 | p1 | taint.cpp:806:7:806:9 | * ... | TAINT |
7740+
| taint.cpp:808:12:808:32 | call to SysAllocStringByteLen | taint.cpp:809:8:809:9 | p2 | |
7741+
| taint.cpp:809:8:809:9 | p2 | taint.cpp:809:7:809:9 | * ... | TAINT |
7742+
| taint.cpp:811:12:811:28 | call to SysAllocStringLen | taint.cpp:812:8:812:9 | p3 | |
7743+
| taint.cpp:812:8:812:9 | p3 | taint.cpp:812:7:812:9 | * ... | TAINT |
77387744
| vector.cpp:16:43:16:49 | source1 | vector.cpp:17:26:17:32 | source1 | |
77397745
| vector.cpp:16:43:16:49 | source1 | vector.cpp:31:38:31:44 | source1 | |
77407746
| 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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,4 +789,25 @@ void fopen_test(char* source) {
789789
FILE* f2;
790790
fopen_s(&f2, source, "r");
791791
sink(f2); // $ ast,ir
792+
}
793+
794+
typedef wchar_t OLECHAR;
795+
typedef OLECHAR* LPOLESTR;
796+
typedef const LPOLESTR LPCOLESTR;
797+
typedef OLECHAR* BSTR;
798+
typedef const char* LPCSTR;
799+
800+
BSTR SysAllocString(const OLECHAR *);
801+
BSTR SysAllocStringByteLen(LPCSTR, unsigned );
802+
BSTR SysAllocStringLen(const OLECHAR *,unsigned);
803+
804+
void test_sysalloc() {
805+
auto p1 = SysAllocString((LPOLESTR)indirect_source());
806+
sink(*p1); // $ MISSING: ir,ast
807+
808+
auto p2 = SysAllocStringByteLen(indirect_source(), 10);
809+
sink(*p2); // $ MISSING: ir,ast
810+
811+
auto p3 = SysAllocStringLen((LPOLESTR)indirect_source(), 10);
812+
sink(*p3); // $ MISSING: ir,ast
792813
}

cpp/ql/test/library-tests/dataflow/taint-tests/test_mad-signatures.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,14 @@ getParameterTypeName
20212021
| taint.cpp:783:5:783:11 | fopen_s | 1 | const char * |
20222022
| taint.cpp:783:5:783:11 | fopen_s | 2 | const char * |
20232023
| taint.cpp:785:6:785:15 | fopen_test | 0 | char * |
2024+
| taint.cpp:800:6:800:19 | SysAllocString | 0 | const OLECHAR * |
2025+
| taint.cpp:800:6:800:19 | SysAllocString | 0 | const wchar_t * |
2026+
| taint.cpp:801:6:801:26 | SysAllocStringByteLen | 0 | LPCSTR |
2027+
| taint.cpp:801:6:801:26 | SysAllocStringByteLen | 0 | const char * |
2028+
| taint.cpp:801:6:801:26 | SysAllocStringByteLen | 1 | unsigned int |
2029+
| taint.cpp:802:6:802:22 | SysAllocStringLen | 0 | const OLECHAR * |
2030+
| taint.cpp:802:6:802:22 | SysAllocStringLen | 0 | const wchar_t * |
2031+
| taint.cpp:802:6:802:22 | SysAllocStringLen | 1 | unsigned int |
20242032
| vector.cpp:13:6:13:9 | sink | 0 | int |
20252033
| vector.cpp:14:27:14:30 | sink | 0 | vector> & |
20262034
| vector.cpp:14:27:14:30 | sink | 0 | vector> & |

0 commit comments

Comments
 (0)