Skip to content

Commit 1ea879a

Browse files
committed
C++: Add failing tests for 'CUrl'.
1 parent 74b6c9d commit 1ea879a

2 files changed

Lines changed: 155 additions & 0 deletions

File tree

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

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,3 +808,92 @@ void test_CSimpleMap() {
808808
sink(a.Lookup("hello")); // $ ir
809809
}
810810
}
811+
812+
struct CUrl {
813+
CUrl& operator= (const CUrl& urlThat) throw();
814+
CUrl() throw();
815+
CUrl(const CUrl& urlThat) throw();
816+
~CUrl() throw();
817+
818+
inline BOOL Canonicalize(DWORD dwFlags) throw();
819+
inline void Clear() throw();
820+
821+
BOOL CrackUrl(LPCTSTR lpszUrl, DWORD dwFlags) throw();
822+
inline BOOL CreateUrl(LPTSTR lpszUrl, DWORD* pdwMaxLength, DWORD dwFlags) const throw();
823+
824+
inline LPCTSTR GetExtraInfo() const throw();
825+
inline DWORD GetExtraInfoLength() const throw();
826+
inline LPCTSTR GetHostName() const throw();
827+
inline DWORD GetHostNameLength() const throw();
828+
inline LPCTSTR GetPassword() const throw();
829+
inline DWORD GetPasswordLength() const throw();
830+
inline ATL_URL_PORT GetPortNumber() const throw();
831+
inline ATL_URL_SCHEME GetScheme() const throw();
832+
inline LPCTSTR GetSchemeName() const throw();
833+
inline DWORD GetSchemeNameLength() const throw();
834+
inline DWORD GetUrlLength() const throw();
835+
inline LPCTSTR GetUrlPath() const throw();
836+
inline DWORD GetUrlPathLength() const throw();
837+
inline LPCTSTR GetUserName() const throw();
838+
inline DWORD GetUserNameLength() const throw();
839+
inline BOOL SetExtraInfo(LPCTSTR lpszInfo) throw();
840+
inline BOOL SetHostName(LPCTSTR lpszHost) throw();
841+
inline BOOL SetPassword(LPCTSTR lpszPass) throw();
842+
inline BOOL SetPortNumber(ATL_URL_PORT nPrt) throw();
843+
inline BOOL SetScheme(ATL_URL_SCHEME nScheme) throw();
844+
inline BOOL SetSchemeName(LPCTSTR lpszSchm) throw();
845+
inline BOOL SetUrlPath(LPCTSTR lpszPath) throw();
846+
inline BOOL SetUserName(LPCTSTR lpszUser) throw();
847+
};
848+
849+
void test_CUrl() {
850+
char* x = indirect_source<char>();
851+
CUrl url;
852+
url.CrackUrl(x, 0);
853+
sink(url); // $ MISSING: ir
854+
sink(url.GetExtraInfo()); // $ MISSING: ir
855+
sink(url.GetHostName()); // $ MISSING: ir
856+
sink(url.GetPassword()); // $ MISSING: ir
857+
sink(url.GetSchemeName()); // $ MISSING: ir
858+
sink(url.GetUrlPath()); // $ MISSING: ir
859+
sink(url.GetUserName()); // $ MISSING: ir
860+
861+
{
862+
CUrl url2;
863+
DWORD len;
864+
char buffer[1024];
865+
url2.CrackUrl(x, 0);
866+
url2.CreateUrl(buffer, &len, 0);
867+
sink(buffer); // $ ast MISSING: ir
868+
}
869+
{
870+
CUrl url2;
871+
url2.SetExtraInfo(x);
872+
sink(url2); // $ MISSING: ir
873+
}
874+
{
875+
CUrl url2;
876+
url2.SetHostName(x);
877+
sink(url2); // $ MISSING: ir
878+
}
879+
{
880+
CUrl url2;
881+
url2.SetPassword(x);
882+
sink(url2); // $ MISSING: ir
883+
}
884+
{
885+
CUrl url2;
886+
url2.SetSchemeName(x);
887+
sink(url2); // $ MISSING: ir
888+
}
889+
{
890+
CUrl url2;
891+
url2.SetUrlPath(x);
892+
sink(url2); // $ MISSING: ir
893+
}
894+
{
895+
CUrl url2;
896+
url2.SetUserName(x);
897+
sink(url2); // $ MISSING: ir
898+
}
899+
}

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

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,72 @@ WARNING: module 'TaintTracking' has been deprecated and may be removed in future
888888
| atl.cpp:807:5:807:5 | ref arg a | atl.cpp:808:10:808:10 | a | |
889889
| atl.cpp:807:5:807:5 | ref arg a | atl.cpp:809:3:809:3 | a | |
890890
| atl.cpp:808:10:808:10 | ref arg a | atl.cpp:809:3:809:3 | a | |
891+
| atl.cpp:850:13:850:33 | call to indirect_source | atl.cpp:852:16:852:16 | x | |
892+
| atl.cpp:850:13:850:33 | call to indirect_source | atl.cpp:865:19:865:19 | x | |
893+
| atl.cpp:850:13:850:33 | call to indirect_source | atl.cpp:871:23:871:23 | x | |
894+
| atl.cpp:850:13:850:33 | call to indirect_source | atl.cpp:876:22:876:22 | x | |
895+
| atl.cpp:850:13:850:33 | call to indirect_source | atl.cpp:881:22:881:22 | x | |
896+
| atl.cpp:850:13:850:33 | call to indirect_source | atl.cpp:886:24:886:24 | x | |
897+
| atl.cpp:850:13:850:33 | call to indirect_source | atl.cpp:891:21:891:21 | x | |
898+
| atl.cpp:850:13:850:33 | call to indirect_source | atl.cpp:896:22:896:22 | x | |
899+
| atl.cpp:851:8:851:10 | call to CUrl | atl.cpp:852:3:852:5 | url | |
900+
| atl.cpp:851:8:851:10 | call to CUrl | atl.cpp:853:8:853:10 | url | |
901+
| atl.cpp:851:8:851:10 | call to CUrl | atl.cpp:854:8:854:10 | url | |
902+
| atl.cpp:851:8:851:10 | call to CUrl | atl.cpp:855:8:855:10 | url | |
903+
| atl.cpp:851:8:851:10 | call to CUrl | atl.cpp:856:8:856:10 | url | |
904+
| atl.cpp:851:8:851:10 | call to CUrl | atl.cpp:857:8:857:10 | url | |
905+
| atl.cpp:851:8:851:10 | call to CUrl | atl.cpp:858:8:858:10 | url | |
906+
| atl.cpp:851:8:851:10 | call to CUrl | atl.cpp:859:8:859:10 | url | |
907+
| atl.cpp:851:8:851:10 | call to CUrl | atl.cpp:899:1:899:1 | url | |
908+
| atl.cpp:852:3:852:5 | ref arg url | atl.cpp:853:8:853:10 | url | |
909+
| atl.cpp:852:3:852:5 | ref arg url | atl.cpp:854:8:854:10 | url | |
910+
| atl.cpp:852:3:852:5 | ref arg url | atl.cpp:855:8:855:10 | url | |
911+
| atl.cpp:852:3:852:5 | ref arg url | atl.cpp:856:8:856:10 | url | |
912+
| atl.cpp:852:3:852:5 | ref arg url | atl.cpp:857:8:857:10 | url | |
913+
| atl.cpp:852:3:852:5 | ref arg url | atl.cpp:858:8:858:10 | url | |
914+
| atl.cpp:852:3:852:5 | ref arg url | atl.cpp:859:8:859:10 | url | |
915+
| atl.cpp:852:3:852:5 | ref arg url | atl.cpp:899:1:899:1 | url | |
916+
| atl.cpp:862:10:862:13 | call to CUrl | atl.cpp:865:5:865:8 | url2 | |
917+
| atl.cpp:862:10:862:13 | call to CUrl | atl.cpp:866:5:866:8 | url2 | |
918+
| atl.cpp:862:10:862:13 | call to CUrl | atl.cpp:868:3:868:3 | url2 | |
919+
| atl.cpp:863:11:863:13 | len | atl.cpp:866:29:866:31 | len | |
920+
| atl.cpp:864:10:864:15 | buffer | atl.cpp:866:20:866:25 | buffer | |
921+
| atl.cpp:864:10:864:15 | buffer | atl.cpp:867:10:867:15 | buffer | |
922+
| atl.cpp:865:5:865:8 | ref arg url2 | atl.cpp:866:5:866:8 | url2 | |
923+
| atl.cpp:865:5:865:8 | ref arg url2 | atl.cpp:868:3:868:3 | url2 | |
924+
| atl.cpp:866:20:866:25 | ref arg buffer | atl.cpp:867:10:867:15 | buffer | |
925+
| atl.cpp:866:28:866:31 | ref arg & ... | atl.cpp:866:29:866:31 | len [inner post update] | |
926+
| atl.cpp:866:29:866:31 | len | atl.cpp:866:28:866:31 | & ... | |
927+
| atl.cpp:870:10:870:13 | call to CUrl | atl.cpp:871:5:871:8 | url2 | |
928+
| atl.cpp:870:10:870:13 | call to CUrl | atl.cpp:872:10:872:13 | url2 | |
929+
| atl.cpp:870:10:870:13 | call to CUrl | atl.cpp:873:3:873:3 | url2 | |
930+
| atl.cpp:871:5:871:8 | ref arg url2 | atl.cpp:872:10:872:13 | url2 | |
931+
| atl.cpp:871:5:871:8 | ref arg url2 | atl.cpp:873:3:873:3 | url2 | |
932+
| atl.cpp:875:10:875:13 | call to CUrl | atl.cpp:876:5:876:8 | url2 | |
933+
| atl.cpp:875:10:875:13 | call to CUrl | atl.cpp:877:10:877:13 | url2 | |
934+
| atl.cpp:875:10:875:13 | call to CUrl | atl.cpp:878:3:878:3 | url2 | |
935+
| atl.cpp:876:5:876:8 | ref arg url2 | atl.cpp:877:10:877:13 | url2 | |
936+
| atl.cpp:876:5:876:8 | ref arg url2 | atl.cpp:878:3:878:3 | url2 | |
937+
| atl.cpp:880:10:880:13 | call to CUrl | atl.cpp:881:5:881:8 | url2 | |
938+
| atl.cpp:880:10:880:13 | call to CUrl | atl.cpp:882:10:882:13 | url2 | |
939+
| atl.cpp:880:10:880:13 | call to CUrl | atl.cpp:883:3:883:3 | url2 | |
940+
| atl.cpp:881:5:881:8 | ref arg url2 | atl.cpp:882:10:882:13 | url2 | |
941+
| atl.cpp:881:5:881:8 | ref arg url2 | atl.cpp:883:3:883:3 | url2 | |
942+
| atl.cpp:885:10:885:13 | call to CUrl | atl.cpp:886:5:886:8 | url2 | |
943+
| atl.cpp:885:10:885:13 | call to CUrl | atl.cpp:887:10:887:13 | url2 | |
944+
| atl.cpp:885:10:885:13 | call to CUrl | atl.cpp:888:3:888:3 | url2 | |
945+
| atl.cpp:886:5:886:8 | ref arg url2 | atl.cpp:887:10:887:13 | url2 | |
946+
| atl.cpp:886:5:886:8 | ref arg url2 | atl.cpp:888:3:888:3 | url2 | |
947+
| atl.cpp:890:10:890:13 | call to CUrl | atl.cpp:891:5:891:8 | url2 | |
948+
| atl.cpp:890:10:890:13 | call to CUrl | atl.cpp:892:10:892:13 | url2 | |
949+
| atl.cpp:890:10:890:13 | call to CUrl | atl.cpp:893:3:893:3 | url2 | |
950+
| atl.cpp:891:5:891:8 | ref arg url2 | atl.cpp:892:10:892:13 | url2 | |
951+
| atl.cpp:891:5:891:8 | ref arg url2 | atl.cpp:893:3:893:3 | url2 | |
952+
| atl.cpp:895:10:895:13 | call to CUrl | atl.cpp:896:5:896:8 | url2 | |
953+
| atl.cpp:895:10:895:13 | call to CUrl | atl.cpp:897:10:897:13 | url2 | |
954+
| atl.cpp:895:10:895:13 | call to CUrl | atl.cpp:898:3:898:3 | url2 | |
955+
| atl.cpp:896:5:896:8 | ref arg url2 | atl.cpp:897:10:897:13 | url2 | |
956+
| atl.cpp:896:5:896:8 | ref arg url2 | atl.cpp:898:3:898:3 | url2 | |
891957
| bsd.cpp:17:11:17:16 | call to source | bsd.cpp:20:18:20:18 | s | |
892958
| bsd.cpp:18:12:18:15 | addr | bsd.cpp:20:22:20:25 | addr | |
893959
| bsd.cpp:18:12:18:15 | addr | bsd.cpp:23:8:23:11 | addr | |

0 commit comments

Comments
 (0)