Skip to content

Commit e78e5b9

Browse files
authored
Merge branch 'main' into promote-jexl-injection
2 parents b37b15c + 8783746 commit e78e5b9

File tree

121 files changed

+3947
-547
lines changed

Some content is hidden

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

121 files changed

+3947
-547
lines changed

cpp/ql/src/Likely Bugs/Arithmetic/SignedOverflowCheck.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* @id cpp/signed-overflow-check
1010
* @tags correctness
1111
* security
12+
* external/cwe/cwe-128
13+
* external/cwe/cwe-190
1214
*/
1315

1416
import cpp

cpp/ql/src/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
* @kind path-problem
88
* @problem.severity warning
99
* @precision high
10+
* @id cpp/upcast-array-pointer-arithmetic
1011
* @tags correctness
1112
* reliability
1213
* security
1314
* external/cwe/cwe-119
1415
* external/cwe/cwe-843
15-
* @id cpp/upcast-array-pointer-arithmetic
1616
*/
1717

1818
import cpp

cpp/ql/src/Likely Bugs/Format/SnprintfOverflow.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* @tags reliability
99
* correctness
1010
* security
11+
* external/cwe/cwe-190
12+
* external/cwe/cwe-253
1113
*/
1214

1315
import cpp

cpp/ql/src/Likely Bugs/Format/WrongNumberOfFormatArguments.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* @tags reliability
1010
* correctness
1111
* security
12+
* external/cwe/cwe-234
1213
* external/cwe/cwe-685
1314
*/
1415

cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @id cpp/pointer-overflow-check
99
* @tags reliability
1010
* security
11+
* external/cwe/cwe-758
1112
*/
1213

1314
import cpp

cpp/ql/src/Likely Bugs/OO/UnsafeUseOfThis.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* @tags correctness
1111
* language-features
1212
* security
13+
* external/cwe/cwe-670
1314
*/
1415

1516
import cpp

cpp/ql/src/Likely Bugs/Underspecified Functions/TooFewArguments.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* @tags correctness
1313
* maintainability
1414
* security
15+
* external/cwe/cwe-234
16+
* external/cwe/cwe-685
1517
*/
1618

1719
import cpp

cpp/ql/src/experimental/Security/CWE/CWE-570/WrongInDetectingAndHandlingMemoryAllocationErrors.ql

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,27 @@ class WrongCheckErrorOperatorNew extends FunctionCall {
5353
* Holds if results call `operator new` check in `operator if`.
5454
*/
5555
predicate isExistsIfCondition() {
56-
exists(IfCompareWithZero ifc, AssignExpr aex, Initializer it |
56+
exists(IfCompareWithZero ifc |
5757
// call `operator new` directly from the condition of `operator if`.
5858
this = ifc.getCondition().getAChild*()
5959
or
60-
// check results call `operator new` with variable appropriation
6160
postDominates(ifc, this) and
62-
aex.getAChild() = exp and
63-
ifc.getCondition().getAChild().(VariableAccess).getTarget() =
64-
aex.getLValue().(VariableAccess).getTarget()
65-
or
66-
// check results call `operator new` with declaration variable
67-
postDominates(ifc, this) and
68-
exp = it.getExpr() and
69-
it.getDeclaration() = ifc.getCondition().getAChild().(VariableAccess).getTarget()
61+
exists(Variable v |
62+
v = ifc.getCondition().getAChild().(VariableAccess).getTarget() and
63+
(
64+
exists(AssignExpr aex |
65+
// check results call `operator new` with variable appropriation
66+
aex.getAChild() = exp and
67+
v = aex.getLValue().(VariableAccess).getTarget()
68+
)
69+
or
70+
exists(Initializer it |
71+
// check results call `operator new` with declaration variable
72+
exp = it.getExpr() and
73+
it.getDeclaration() = v
74+
)
75+
)
76+
)
7077
)
7178
}
7279

cpp/ql/src/semmle/code/cpp/Type.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class Type extends Locatable, @type {
101101
*
102102
* For example, starting with `const i64* const` in the context of `typedef long long i64;`, this predicate will return `long long*`.
103103
*/
104+
pragma[nomagic]
104105
Type getUnspecifiedType() { unspecifiedtype(underlyingElement(this), unresolveElement(result)) }
105106

106107
/**

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ class Instruction extends Construction::TStageInstruction {
297297
/**
298298
* Gets the opcode that specifies the operation performed by this instruction.
299299
*/
300-
final Opcode getOpcode() { result = Construction::getInstructionOpcode(this) }
300+
pragma[inline]
301+
final Opcode getOpcode() { Construction::getInstructionOpcode(result, this) }
301302

302303
/**
303304
* Gets all direct uses of the result of this instruction. The result can be

0 commit comments

Comments
 (0)