Skip to content

Commit 884df51

Browse files
authored
Merge branch 'main' into shati-patel/mrva-results-view
2 parents 12507aa + 7323d4e commit 884df51

File tree

690 files changed

+15597
-5640
lines changed

Some content is hidden

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

690 files changed

+15597
-5640
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extensions": [
3-
"rust-lang.rust",
3+
"rust-lang.rust-analyzer",
44
"bungcip.better-toml",
55
"github.vscode-codeql",
66
"hbenl.vscode-test-explorer",
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test tree-sitter-extractor
2+
3+
on:
4+
push:
5+
paths:
6+
- "shared/tree-sitter-extractor/**"
7+
- .github/workflows/tree-sitter-extractor-test.yml
8+
branches:
9+
- main
10+
- "rc/*"
11+
pull_request:
12+
paths:
13+
- "shared/tree-sitter-extractor/**"
14+
- .github/workflows/tree-sitter-extractor-test.yml
15+
branches:
16+
- main
17+
- "rc/*"
18+
19+
env:
20+
CARGO_TERM_COLOR: always
21+
22+
defaults:
23+
run:
24+
working-directory: shared/tree-sitter-extractor
25+
26+
jobs:
27+
test:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v3
31+
- name: Check formatting
32+
run: cargo fmt --all -- --check
33+
- name: Run tests
34+
run: cargo test --verbose
35+
fmt:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v3
39+
- name: Check formatting
40+
run: cargo fmt --check
41+
clippy:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v3
45+
- name: Run clippy
46+
run: cargo clippy -- --no-deps -D warnings -A clippy::new_without_default -A clippy::too_many_arguments

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.7.1
2+
3+
No user-facing changes.
4+
15
## 0.7.0
26

37
### Breaking Changes
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: feature
3+
---
4+
* A new predicate `BarrierGuard::getAnIndirectBarrierNode` has been added to the new dataflow library (`semmle.code.cpp.dataflow.new.DataFlow`) to mark indirect expressions as barrier nodes using the `BarrierGuard` API.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: majorAnalysis
3+
---
4+
* In the intermediate representation, handling of control flow after non-returning calls has been improved. This should remove false positives in queries that use the intermedite representation or libraries based on it, including the new data flow library.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: feature
3+
---
4+
* Added an AST-based interface (`semmle.code.cpp.rangeanalysis.new.RangeAnalysis`) for the relative range analysis library.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.7.1
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.7.0
2+
lastReleaseVersion: 0.7.1

cpp/ql/lib/experimental/semmle/code/cpp/dataflow/ProductFlow.qll

Lines changed: 97 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import semmle.code.cpp.ir.dataflow.DataFlow
2+
private import semmle.code.cpp.ir.dataflow.internal.DataFlowPrivate
3+
private import semmle.code.cpp.ir.dataflow.internal.DataFlowUtil
4+
private import semmle.code.cpp.ir.dataflow.internal.DataFlowImplCommon
25
private import codeql.util.Unit
36

47
module ProductFlow {
@@ -352,32 +355,119 @@ module ProductFlow {
352355
pragma[only_bind_out](succ.getNode().getEnclosingCallable())
353356
}
354357

358+
private newtype TKind =
359+
TInto(DataFlowCall call) {
360+
intoImpl1(_, _, call) or
361+
intoImpl2(_, _, call)
362+
} or
363+
TOutOf(DataFlowCall call) {
364+
outImpl1(_, _, call) or
365+
outImpl2(_, _, call)
366+
} or
367+
TJump()
368+
369+
private predicate intoImpl1(Flow1::PathNode pred1, Flow1::PathNode succ1, DataFlowCall call) {
370+
Flow1::PathGraph::edges(pred1, succ1) and
371+
pred1.getNode().(ArgumentNode).getCall() = call and
372+
succ1.getNode() instanceof ParameterNode
373+
}
374+
375+
private predicate into1(Flow1::PathNode pred1, Flow1::PathNode succ1, TKind kind) {
376+
exists(DataFlowCall call |
377+
kind = TInto(call) and
378+
intoImpl1(pred1, succ1, call)
379+
)
380+
}
381+
382+
private predicate outImpl1(Flow1::PathNode pred1, Flow1::PathNode succ1, DataFlowCall call) {
383+
Flow1::PathGraph::edges(pred1, succ1) and
384+
exists(ReturnKindExt returnKind |
385+
succ1.getNode() = returnKind.getAnOutNode(call) and
386+
pred1.getNode().(ReturnNodeExt).getKind() = returnKind
387+
)
388+
}
389+
390+
private predicate out1(Flow1::PathNode pred1, Flow1::PathNode succ1, TKind kind) {
391+
exists(DataFlowCall call |
392+
outImpl1(pred1, succ1, call) and
393+
kind = TOutOf(call)
394+
)
395+
}
396+
397+
private predicate intoImpl2(Flow2::PathNode pred2, Flow2::PathNode succ2, DataFlowCall call) {
398+
Flow2::PathGraph::edges(pred2, succ2) and
399+
pred2.getNode().(ArgumentNode).getCall() = call and
400+
succ2.getNode() instanceof ParameterNode
401+
}
402+
403+
private predicate into2(Flow2::PathNode pred2, Flow2::PathNode succ2, TKind kind) {
404+
exists(DataFlowCall call |
405+
kind = TInto(call) and
406+
intoImpl2(pred2, succ2, call)
407+
)
408+
}
409+
410+
private predicate outImpl2(Flow2::PathNode pred2, Flow2::PathNode succ2, DataFlowCall call) {
411+
Flow2::PathGraph::edges(pred2, succ2) and
412+
exists(ReturnKindExt returnKind |
413+
succ2.getNode() = returnKind.getAnOutNode(call) and
414+
pred2.getNode().(ReturnNodeExt).getKind() = returnKind
415+
)
416+
}
417+
418+
private predicate out2(Flow2::PathNode pred2, Flow2::PathNode succ2, TKind kind) {
419+
exists(DataFlowCall call |
420+
kind = TOutOf(call) and
421+
outImpl2(pred2, succ2, call)
422+
)
423+
}
424+
355425
pragma[nomagic]
356426
private predicate interprocEdge1(
357-
Declaration predDecl, Declaration succDecl, Flow1::PathNode pred1, Flow1::PathNode succ1
427+
Declaration predDecl, Declaration succDecl, Flow1::PathNode pred1, Flow1::PathNode succ1,
428+
TKind kind
358429
) {
359430
Flow1::PathGraph::edges(pred1, succ1) and
360431
predDecl != succDecl and
361432
pred1.getNode().getEnclosingCallable() = predDecl and
362-
succ1.getNode().getEnclosingCallable() = succDecl
433+
succ1.getNode().getEnclosingCallable() = succDecl and
434+
(
435+
into1(pred1, succ1, kind)
436+
or
437+
out1(pred1, succ1, kind)
438+
or
439+
kind = TJump() and
440+
not into1(pred1, succ1, _) and
441+
not out1(pred1, succ1, _)
442+
)
363443
}
364444

365445
pragma[nomagic]
366446
private predicate interprocEdge2(
367-
Declaration predDecl, Declaration succDecl, Flow2::PathNode pred2, Flow2::PathNode succ2
447+
Declaration predDecl, Declaration succDecl, Flow2::PathNode pred2, Flow2::PathNode succ2,
448+
TKind kind
368449
) {
369450
Flow2::PathGraph::edges(pred2, succ2) and
370451
predDecl != succDecl and
371452
pred2.getNode().getEnclosingCallable() = predDecl and
372-
succ2.getNode().getEnclosingCallable() = succDecl
453+
succ2.getNode().getEnclosingCallable() = succDecl and
454+
(
455+
into2(pred2, succ2, kind)
456+
or
457+
out2(pred2, succ2, kind)
458+
or
459+
kind = TJump() and
460+
not into2(pred2, succ2, _) and
461+
not out2(pred2, succ2, _)
462+
)
373463
}
374464

375465
private predicate interprocEdgePair(
376466
Flow1::PathNode pred1, Flow2::PathNode pred2, Flow1::PathNode succ1, Flow2::PathNode succ2
377467
) {
378-
exists(Declaration predDecl, Declaration succDecl |
379-
interprocEdge1(predDecl, succDecl, pred1, succ1) and
380-
interprocEdge2(predDecl, succDecl, pred2, succ2)
468+
exists(Declaration predDecl, Declaration succDecl, TKind kind |
469+
interprocEdge1(predDecl, succDecl, pred1, succ1, kind) and
470+
interprocEdge2(predDecl, succDecl, pred2, succ2, kind)
381471
)
382472
}
383473

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.7.1-dev
2+
version: 0.7.2-dev
33
groups: cpp
44
dbscheme: semmlecode.cpp.dbscheme
55
extractor: cpp

0 commit comments

Comments
 (0)