Skip to content

Commit dc6bfad

Browse files
committed
Merge remote-tracking branch 'upstream/master' into CVE481
2 parents 90e5671 + db33c36 commit dc6bfad

File tree

104 files changed

+4869
-97
lines changed

Some content is hidden

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

104 files changed

+4869
-97
lines changed

change-notes/1.24/analysis-javascript.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## General improvements
44

5+
* TypeScript 3.8 is now supported.
6+
57
* Alert suppression can now be done with single-line block comments (`/* ... */`) as well as line comments (`// ...`).
68

79
* Imports with the `.js` extension can now be resolved to a TypeScript file,
@@ -13,7 +15,9 @@
1315

1416
* The analysis of sanitizer guards has improved, leading to fewer false-positive results from the security queries.
1517

16-
* Calls can now be resolved to class members in more cases, leading to more results from the security queries.
18+
* The call graph construction has been improved, leading to more results from the security queries:
19+
- Calls can now be resolved to indirectly-defined class members in more cases.
20+
- Calls through partial invocations such as `.bind` can now be resolved in more cases.
1721

1822
* Support for the following frameworks and libraries has been improved:
1923
- [Electron](https://electronjs.org/)

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowDispatch.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
private import cpp
22

3-
Function viableImpl(Call call) { result = viableCallable(call) }
4-
53
/**
64
* Gets a function that might be called by `call`.
75
*/

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,6 @@ OutNode getAnOutNode(DataFlowCall call, ReturnKind kind) {
132132
*/
133133
predicate jumpStep(Node n1, Node n2) { none() }
134134

135-
/**
136-
* Holds if `call` passes an implicit or explicit qualifier, i.e., a
137-
* `this` parameter.
138-
*/
139-
predicate callHasQualifier(Call call) {
140-
call.hasQualifier()
141-
or
142-
call.getTarget() instanceof Destructor
143-
}
144-
145135
private newtype TContent =
146136
TFieldContent(Field f) or
147137
TCollectionContent() or

cpp/ql/src/semmle/code/cpp/ir/dataflow/DefaultTaintTracking.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,15 @@ private Element adjustedSink(DataFlow::Node sink) {
343343
result.(AssignOperation).getAnOperand() = sink.asExpr()
344344
}
345345

346+
cached
346347
predicate tainted(Expr source, Element tainted) {
347348
exists(DefaultTaintTrackingCfg cfg, DataFlow::Node sink |
348349
cfg.hasFlow(getNodeForSource(source), sink) and
349350
tainted = adjustedSink(sink)
350351
)
351352
}
352353

354+
cached
353355
predicate taintedIncludingGlobalVars(Expr source, Element tainted, string globalVar) {
354356
tainted(source, tainted) and
355357
globalVar = ""

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ private import semmle.code.cpp.ir.IR
33
private import semmle.code.cpp.ir.dataflow.DataFlow
44
private import semmle.code.cpp.ir.dataflow.internal.DataFlowPrivate
55

6-
Function viableImpl(CallInstruction call) { result = viableCallable(call) }
7-
86
/**
97
* Gets a function that might be called by `call`.
108
*/

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,6 @@ OutNode getAnOutNode(DataFlowCall call, ReturnKind kind) {
6767
*/
6868
predicate jumpStep(Node n1, Node n2) { none() }
6969

70-
/**
71-
* Holds if `call` passes an implicit or explicit qualifier, i.e., a
72-
* `this` parameter.
73-
*/
74-
predicate callHasQualifier(Call call) {
75-
call.hasQualifier()
76-
or
77-
call.getTarget() instanceof Destructor
78-
}
79-
8070
private newtype TContent =
8171
TFieldContent(Field f) or
8272
TCollectionContent() or

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,16 @@ module InstructionSanity {
266266
funcText = Language::getIdentityString(func.getFunction())
267267
)
268268
}
269+
270+
query predicate switchInstructionWithoutDefaultEdge(
271+
SwitchInstruction switchInstr, string message, IRFunction func, string funcText
272+
) {
273+
not exists(switchInstr.getDefaultSuccessor()) and
274+
message =
275+
"SwitchInstruction " + switchInstr.toString() + " without a DefaultEdge in function '$@'." and
276+
func = switchInstr.getEnclosingIRFunction() and
277+
funcText = Language::getIdentityString(func.getFunction())
278+
}
269279
}
270280

271281
/**

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,16 @@ module InstructionSanity {
266266
funcText = Language::getIdentityString(func.getFunction())
267267
)
268268
}
269+
270+
query predicate switchInstructionWithoutDefaultEdge(
271+
SwitchInstruction switchInstr, string message, IRFunction func, string funcText
272+
) {
273+
not exists(switchInstr.getDefaultSuccessor()) and
274+
message =
275+
"SwitchInstruction " + switchInstr.toString() + " without a DefaultEdge in function '$@'." and
276+
func = switchInstr.getEnclosingIRFunction() and
277+
funcText = Language::getIdentityString(func.getFunction())
278+
}
269279
}
270280

271281
/**

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,11 @@ class TranslatedSwitchStmt extends TranslatedStmt {
655655
kind = getCaseEdge(switchCase) and
656656
result = getTranslatedStmt(switchCase).getFirstInstruction()
657657
)
658+
or
659+
not stmt.hasDefaultCase() and
660+
tag = SwitchBranchTag() and
661+
kind instanceof DefaultEdge and
662+
result = getParent().getChildSuccessor(this)
658663
}
659664

660665
override Instruction getChildSuccessor(TranslatedElement child) {

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,16 @@ module InstructionSanity {
266266
funcText = Language::getIdentityString(func.getFunction())
267267
)
268268
}
269+
270+
query predicate switchInstructionWithoutDefaultEdge(
271+
SwitchInstruction switchInstr, string message, IRFunction func, string funcText
272+
) {
273+
not exists(switchInstr.getDefaultSuccessor()) and
274+
message =
275+
"SwitchInstruction " + switchInstr.toString() + " without a DefaultEdge in function '$@'." and
276+
func = switchInstr.getEnclosingIRFunction() and
277+
funcText = Language::getIdentityString(func.getFunction())
278+
}
269279
}
270280

271281
/**

0 commit comments

Comments
 (0)