Skip to content

Commit 64dd8b9

Browse files
authored
Merge branch 'main' into java/refactor-dataflow-queries-1
2 parents e7f8567 + 8356991 commit 64dd8b9

File tree

777 files changed

+15848
-10918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

777 files changed

+15848
-10918
lines changed

cpp/autobuilder/Semmle.Autobuild.Cpp.Tests/BuildScripts.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Xunit;
22
using Semmle.Autobuild.Shared;
3+
using Semmle.Util;
34
using System.Collections.Generic;
45
using System;
56
using System.Linq;
@@ -75,6 +76,15 @@ int IBuildActions.RunProcess(string cmd, string args, string? workingDirectory,
7576
throw new ArgumentException("Missing RunProcess " + pattern);
7677
}
7778

79+
int IBuildActions.RunProcess(string cmd, string args, string? workingDirectory, IDictionary<string, string>? env, BuildOutputHandler onOutput, BuildOutputHandler onError)
80+
{
81+
var ret = (this as IBuildActions).RunProcess(cmd, args, workingDirectory, env, out var stdout);
82+
83+
stdout.ForEach(line => onOutput(line));
84+
85+
return ret;
86+
}
87+
7888
public IList<string> DirectoryDeleteIn = new List<string>();
7989

8090
void IBuildActions.DirectoryDelete(string dir, bool recursive)
@@ -184,6 +194,15 @@ public void DownloadFile(string address, string fileName)
184194
if (!DownloadFiles.Contains((address, fileName)))
185195
throw new ArgumentException($"Missing DownloadFile, {address}, {fileName}");
186196
}
197+
198+
public IDiagnosticsWriter CreateDiagnosticsWriter(string filename) => new TestDiagnosticWriter();
199+
}
200+
201+
internal class TestDiagnosticWriter : IDiagnosticsWriter
202+
{
203+
public IList<DiagnosticMessage> Diagnostics { get; } = new List<DiagnosticMessage>();
204+
205+
public void AddEntry(DiagnosticMessage message) => this.Diagnostics.Add(message);
187206
}
188207

189208
/// <summary>
@@ -243,6 +262,7 @@ CppAutobuilder CreateAutoBuilder(bool isWindows,
243262
Actions.GetEnvironmentVariable[$"CODEQL_EXTRACTOR_{codeqlUpperLanguage}_TRAP_DIR"] = "";
244263
Actions.GetEnvironmentVariable[$"CODEQL_EXTRACTOR_{codeqlUpperLanguage}_SOURCE_ARCHIVE_DIR"] = "";
245264
Actions.GetEnvironmentVariable[$"CODEQL_EXTRACTOR_{codeqlUpperLanguage}_ROOT"] = $@"C:\codeql\{codeqlUpperLanguage.ToLowerInvariant()}";
265+
Actions.GetEnvironmentVariable[$"CODEQL_EXTRACTOR_{codeqlUpperLanguage}_DIAGNOSTIC_DIR"] = "";
246266
Actions.GetEnvironmentVariable["CODEQL_JAVA_HOME"] = @"C:\codeql\tools\java";
247267
Actions.GetEnvironmentVariable["CODEQL_PLATFORM"] = "win64";
248268
Actions.GetEnvironmentVariable["SEMMLE_DIST"] = @"C:\odasa";

cpp/autobuilder/Semmle.Autobuild.Cpp/CppAutobuilder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Semmle.Autobuild.Shared;
2+
using Semmle.Util;
23

34
namespace Semmle.Autobuild.Cpp
45
{
@@ -21,7 +22,7 @@ public CppAutobuildOptions(IBuildActions actions) : base(actions)
2122

2223
public class CppAutobuilder : Autobuilder<CppAutobuildOptions>
2324
{
24-
public CppAutobuilder(IBuildActions actions, CppAutobuildOptions options) : base(actions, options) { }
25+
public CppAutobuilder(IBuildActions actions, CppAutobuildOptions options) : base(actions, options, new DiagnosticClassifier()) { }
2526

2627
public override BuildScript GetBuildScript()
2728
{

cpp/ql/lib/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.4
2+
3+
No user-facing changes.
4+
15
## 0.5.3
26

37
No user-facing changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.5.4
2+
3+
No user-facing changes.

cpp/ql/lib/codeql-pack.release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.5.3
2+
lastReleaseVersion: 0.5.4

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ module Impl<FullStateConfigSig Config> {
456456
* The Boolean `cc` records whether the node is reached through an
457457
* argument in a call.
458458
*/
459+
pragma[assume_small_delta]
459460
private predicate fwdFlow(NodeEx node, Cc cc) {
460461
sourceNode(node, _) and
461462
if hasSourceCallCtx() then cc = true else cc = false

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTracking.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import TaintTrackingParameter::Public
77
private import TaintTrackingParameter::Private
88

99
private module AddTaintDefaults<DataFlowInternal::FullStateConfigSig Config> implements
10-
DataFlowInternal::FullStateConfigSig {
10+
DataFlowInternal::FullStateConfigSig
11+
{
1112
import Config
1213

1314
predicate isBarrier(DataFlow::Node node) {

cpp/ql/lib/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cpp-all
2-
version: 0.5.4-dev
2+
version: 0.5.5-dev
33
groups: cpp
44
dbscheme: semmlecode.cpp.dbscheme
55
extractor: cpp

cpp/ql/lib/semmle/code/cpp/Declaration.qll

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class Declaration extends Locatable, @declaration {
186186
predicate hasDefinition() { exists(this.getDefinition()) }
187187

188188
/** DEPRECATED: Use `hasDefinition` instead. */
189-
predicate isDefined() { this.hasDefinition() }
189+
deprecated predicate isDefined() { this.hasDefinition() }
190190

191191
/** Gets the preferred location of this declaration, if any. */
192192
override Location getLocation() { none() }
@@ -619,11 +619,10 @@ private class DirectAccessHolder extends Element {
619619
/**
620620
* Like `couldAccessMember` but only contains derivations in which either
621621
* (5.2), (5.3) or (5.4) must be invoked. In other words, the `this`
622-
* parameter is not ignored. This restriction makes it feasible to fully
623-
* enumerate this predicate even on large code bases. We check for 11.4 as
624-
* part of (5.3), since this further limits the number of tuples produced by
625-
* this predicate.
622+
* parameter is not ignored. We check for 11.4 as part of (5.3), since
623+
* this further limits the number of tuples produced by this predicate.
626624
*/
625+
pragma[inline]
627626
predicate thisCouldAccessMember(Class memberClass, AccessSpecifier memberAccess, Class derived) {
628627
// Only (5.4) is recursive, and chains of invocations of (5.4) can always
629628
// be collapsed to one invocation by the transitivity of 11.2/4.
@@ -665,7 +664,9 @@ private class DirectAccessHolder extends Element {
665664
// bypasses `p`. Then that path must be public, or we are in case 2.
666665
exists(AccessSpecifier public | public.hasName("public") |
667666
exists(Class between, Class p |
668-
between.accessOfBaseMember(memberClass, memberAccess).hasName("protected") and
667+
between
668+
.accessOfBaseMember(pragma[only_bind_into](memberClass), memberAccess)
669+
.hasName("protected") and
669670
this.isFriendOfOrEqualTo(p) and
670671
(
671672
// This is case 1 from above. If `p` derives privately from `between`

cpp/ql/lib/semmle/code/cpp/Function.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
4141
* `min<int>(int, int) -> int`, and the full signature of the uninstantiated
4242
* template on the first line would be `min<T>(T, T) -> T`.
4343
*/
44-
string getFullSignature() {
44+
deprecated string getFullSignature() {
4545
exists(string name, string templateArgs, string args |
4646
result = name + templateArgs + args + " -> " + this.getType().toString() and
4747
name = this.getQualifiedName() and

0 commit comments

Comments
 (0)