Skip to content

Commit 3d6b3a3

Browse files
committed
C++: Also join on the 'namespace'.
1 parent bfe2b7d commit 3d6b3a3

File tree

3 files changed

+147
-145
lines changed

3 files changed

+147
-145
lines changed

cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,14 +838,16 @@ private Function getFunction(string namespace, string type, boolean subtypes, st
838838
* is `func:n` then the signature name is compared with the `n`'th name
839839
* in `name`.
840840
*/
841-
private predicate signatureMatches(Function func, string signature, string type, string name, int i) {
842-
func = getFunction(_, type, _, name) and
841+
private predicate signatureMatches(
842+
Function func, string namespace, string signature, string type, string name, int i
843+
) {
844+
func = getFunction(namespace, type, _, name) and
843845
exists(string s |
844846
s = getSignatureParameterName(signature, type, name, i) and
845847
s = getParameterTypeName(func, i)
846848
) and
847849
if exists(getParameterTypeName(func, i + 1))
848-
then signatureMatches(func, signature, type, name, i + 1)
850+
then signatureMatches(func, namespace, signature, type, name, i + 1)
849851
else i = count(signature.indexOf(","))
850852
}
851853

@@ -860,7 +862,7 @@ module ExternalFlowDebug {
860862
*
861863
* Exposed for testing purposes.
862864
*/
863-
predicate signatureMatches_debug = signatureMatches/5;
865+
predicate signatureMatches_debug = signatureMatches/6;
864866

865867
/**
866868
* INTERNAL: Do not use.
@@ -936,7 +938,7 @@ private predicate elementSpecMatchesSignature(
936938
) {
937939
elementSpec(namespace, pragma[only_bind_into](type), subtypes, pragma[only_bind_into](name),
938940
pragma[only_bind_into](signature), _) and
939-
signatureMatches(func, signature, type, name, 0)
941+
signatureMatches(func, namespace, signature, type, name, 0)
940942
}
941943

942944
/**

0 commit comments

Comments
 (0)