Skip to content

Commit 576f021

Browse files
committed
C++: Fix Code Scanning errors.
1 parent 4762e88 commit 576f021

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

cpp/ql/lib/semmle/code/cpp/security/InvalidPointerDereference/AllocationToInvalidPointer.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ private import cpp
22
private import semmle.code.cpp.ir.dataflow.internal.ProductFlow
33
private import semmle.code.cpp.ir.ValueNumbering
44
private import semmle.code.cpp.controlflow.IRGuards
5-
private import semmle.code.cpp.ir.IR
65
private import codeql.util.Unit
76
private import RangeAnalysisUtil
87

cpp/ql/lib/semmle/code/cpp/security/InvalidPointerDereference/InvalidPointerToDereference.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ private import cpp
22
private import semmle.code.cpp.dataflow.new.DataFlow
33
private import semmle.code.cpp.ir.ValueNumbering
44
private import semmle.code.cpp.controlflow.IRGuards
5-
private import semmle.code.cpp.ir.IR
65
private import AllocationToInvalidPointer as AllocToInvalidPointer
76
private import RangeAnalysisUtil
87

@@ -174,7 +173,7 @@ private predicate derefSinkToOperation(
174173
* Holds if `allocation` is the result of an allocation that flows to the left-hand side of `pai`, and where
175174
* the right-hand side of `pai` is an offset such that the result of `pai` points to an out-of-bounds pointer.
176175
*
177-
* Futhermore, `derefSource` is at least as large as `pai` and flows to `derefSink` before being dereferenced
176+
* Furthermore, `derefSource` is at least as large as `pai` and flows to `derefSink` before being dereferenced
178177
* by `operation` (which is either a `StoreInstruction` or `LoadInstruction`). The result is that `operation`
179178
* dereferences a pointer that's "off by `delta`" number of elements.
180179
*/

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/pointer-deref/AllocationToInvalidPointer.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ module AllocationToInvalidPointerTest implements TestSig {
88
string getARelevantTag() { result = "alloc" }
99

1010
predicate hasActualResult(Location location, string element, string tag, string value) {
11-
exists(DataFlow::Node allocation, PointerAddInstruction pai, DataFlow::Node sink1, int delta |
12-
pointerAddInstructionHasBounds(allocation, pai, sink1, delta) and
11+
exists(DataFlow::Node allocation, PointerAddInstruction pai, int delta |
12+
pointerAddInstructionHasBounds(allocation, pai, _, delta) and
1313
location = pai.getLocation() and
1414
element = pai.toString() and
1515
tag = "alloc"

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/pointer-deref/InvalidPointerToDereference.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ module InvalidPointerToDereferenceTest implements TestSig {
4848

4949
predicate hasActualResult(Location location, string element, string tag, string value) {
5050
exists(
51-
PointerArithmeticInstruction pai, DataFlow::Node derefSource, DataFlow::Node derefSink,
52-
DataFlow::Node operation, int delta, string value1, string value2
51+
DataFlow::Node derefSource, DataFlow::Node derefSink, DataFlow::Node operation, int delta,
52+
string value1, string value2
5353
|
54-
operationIsOffBy(_, pai, derefSource, derefSink, _, operation, delta) and
54+
operationIsOffBy(_, _, derefSource, derefSink, _, operation, delta) and
5555
location = operation.getLocation() and
5656
element = operation.toString() and
5757
tag = "deref" and

0 commit comments

Comments
 (0)