Skip to content

Commit ae6fb33

Browse files
committed
C++: Also add taint from the service argument.
1 parent cce40cc commit ae6fb33

4 files changed

Lines changed: 178 additions & 33 deletions

File tree

cpp/ql/lib/ext/Boost.Asio.model.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ extensions:
2323
extensible: summaryModel
2424
data: # namespace, type, subtypes, name, signature, ext, input, output, kind, provenance
2525
- ["boost::asio", "", False, "buffer", "", "", "Argument[*0]", "ReturnValue", "taint", "manual"]
26-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const string &,const string &)", "", "Argument[*0]", "ReturnValue", "taint", "manual"]
27-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const string &,const string &,error_code &)", "", "Argument[*0]", "ReturnValue", "taint", "manual"]
28-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const string &,const string &,flags)", "", "Argument[*0]", "ReturnValue", "taint", "manual"]
29-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const string &,const string &,flags,error_code &)", "", "Argument[*0]", "ReturnValue", "taint", "manual"]
30-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view)", "", "Argument[0]", "ReturnValue", "taint", "manual"]
31-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view,error_code &)", "", "Argument[0]", "ReturnValue", "taint", "manual"]
32-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view,flags)", "", "Argument[0]", "ReturnValue", "taint", "manual"]
33-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view,flags,error_code &)", "", "Argument[0]", "ReturnValue", "taint", "manual"]
34-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &)", "", "Argument[*1]", "ReturnValue", "taint", "manual"]
35-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &,error_code &)", "", "Argument[*1]", "ReturnValue", "taint", "manual"]
36-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &,flags)", "", "Argument[*1]", "ReturnValue", "taint", "manual"]
37-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &,flags,error_code &)", "", "Argument[*1]", "ReturnValue", "taint", "manual"]
38-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view)", "", "Argument[1]", "ReturnValue", "taint", "manual"]
39-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view,error_code &)", "", "Argument[1]", "ReturnValue", "taint", "manual"]
40-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view,flags)", "", "Argument[1]", "ReturnValue", "taint", "manual"]
41-
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view,flags,error_code &)", "", "Argument[1]", "ReturnValue", "taint", "manual"]
26+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const string &,const string &)", "", "Argument[*0..1]", "ReturnValue", "taint", "manual"]
27+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const string &,const string &,error_code &)", "", "Argument[*0..1]", "ReturnValue", "taint", "manual"]
28+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const string &,const string &,flags)", "", "Argument[*0..1]", "ReturnValue", "taint", "manual"]
29+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const string &,const string &,flags,error_code &)", "", "Argument[*0..1]", "ReturnValue", "taint", "manual"]
30+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view)", "", "Argument[0..1]", "ReturnValue", "taint", "manual"]
31+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view,error_code &)", "", "Argument[0..1]", "ReturnValue", "taint", "manual"]
32+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view,flags)", "", "Argument[0..1]", "ReturnValue", "taint", "manual"]
33+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view,flags,error_code &)", "", "Argument[0..1]", "ReturnValue", "taint", "manual"]
34+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &)", "", "Argument[*1..2]", "ReturnValue", "taint", "manual"]
35+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &,error_code &)", "", "Argument[*1..2]", "ReturnValue", "taint", "manual"]
36+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &,flags)", "", "Argument[*1..2]", "ReturnValue", "taint", "manual"]
37+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &,flags,error_code &)", "", "Argument[*1..2]", "ReturnValue", "taint", "manual"]
38+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view)", "", "Argument[1..2]", "ReturnValue", "taint", "manual"]
39+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view,error_code &)", "", "Argument[1..2]", "ReturnValue", "taint", "manual"]
40+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view,flags)", "", "Argument[1..2]", "ReturnValue", "taint", "manual"]
41+
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view,flags,error_code &)", "", "Argument[1..2]", "ReturnValue", "taint", "manual"]

cpp/ql/test/library-tests/dataflow/external-models/asio_streams.cpp

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void test(boost::asio::ip::tcp::socket &socket) {
148148
}
149149
}
150150

151-
void test_resolve() {
151+
void test_resolve_host() {
152152
boost::asio::ip::tcp::resolver resolver;
153153
boost::asio::ip::tcp protocol;
154154
boost::asio::ip::resolver_base::flags flags = boost::asio::ip::resolver_base::passive;
@@ -178,3 +178,34 @@ void test_resolve() {
178178
sink(resolver.resolve(protocol, host_view, service_view, flags)); // $ ir
179179
sink(resolver.resolve(protocol, host_view, service_view, flags, error)); // $ ir
180180
}
181+
182+
void test_resolve_service() {
183+
boost::asio::ip::tcp::resolver resolver;
184+
boost::asio::ip::tcp protocol;
185+
boost::asio::ip::resolver_base::flags flags = boost::asio::ip::resolver_base::passive;
186+
boost::system::error_code error;
187+
std::string host("");
188+
std::string service(source());
189+
std::string_view host_view("");
190+
std::string_view service_view(source());
191+
192+
sink(resolver.resolve(host, service)); // $ ir
193+
sink(resolver.resolve(host, service, error)); // $ ir
194+
sink(resolver.resolve(host, service, flags)); // $ ir
195+
sink(resolver.resolve(host, service, flags, error)); // $ ir
196+
197+
sink(resolver.resolve(host_view, service_view)); // $ ir
198+
sink(resolver.resolve(host_view, service_view, error)); // $ ir
199+
sink(resolver.resolve(host_view, service_view, flags)); // $ ir
200+
sink(resolver.resolve(host_view, service_view, flags, error)); // $ ir
201+
202+
sink(resolver.resolve(protocol, host, service)); // $ ir
203+
sink(resolver.resolve(protocol, host, service, error)); // $ ir
204+
sink(resolver.resolve(protocol, host, service, flags)); // $ ir
205+
sink(resolver.resolve(protocol, host, service, flags, error)); // $ ir
206+
207+
sink(resolver.resolve(protocol, host_view, service_view)); // $ ir
208+
sink(resolver.resolve(protocol, host_view, service_view, error)); // $ ir
209+
sink(resolver.resolve(protocol, host_view, service_view, flags)); // $ ir
210+
sink(resolver.resolve(protocol, host_view, service_view, flags, error)); // $ ir
211+
}

0 commit comments

Comments
 (0)