Skip to content

Commit 6cdef78

Browse files
committed
Merge branch 'main' into improve-wrong-in-detecting-and-handling-memory-allocation-errors
2 parents 4202159 + 059a5f3 commit 6cdef78

File tree

35 files changed

+452
-80
lines changed

35 files changed

+452
-80
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/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

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,15 +338,21 @@ private module Cached {
338338
instr = unreachedInstruction(_) and result = Language::getVoidType()
339339
}
340340

341+
/**
342+
* Holds if `opcode` is the opcode that specifies the operation performed by `instr`.
343+
*
344+
* The parameters are ordered such that they produce a clean join (with no need for reordering)
345+
* in the characteristic predicates of the `Instruction` subclasses.
346+
*/
341347
cached
342-
Opcode getInstructionOpcode(Instruction instr) {
343-
result = getOldInstruction(instr).getOpcode()
348+
predicate getInstructionOpcode(Opcode opcode, Instruction instr) {
349+
opcode = getOldInstruction(instr).getOpcode()
344350
or
345-
instr = phiInstruction(_, _) and result instanceof Opcode::Phi
351+
instr = phiInstruction(_, _) and opcode instanceof Opcode::Phi
346352
or
347-
instr = chiInstruction(_) and result instanceof Opcode::Chi
353+
instr = chiInstruction(_) and opcode instanceof Opcode::Chi
348354
or
349-
instr = unreachedInstruction(_) and result instanceof Opcode::Unreached
355+
instr = unreachedInstruction(_) and opcode instanceof Opcode::Unreached
350356
}
351357

352358
cached

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/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)