Skip to content

Commit c86fc22

Browse files
committed
C++: Fix comment and prevent false positives on chiOnlyPartiallyUpdatesLocation when Alias::getEndBitOffset doesn't have known value.
1 parent bd84240 commit c86fc22

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,11 @@ MemoryLocation getOperandMemoryLocation(MemoryOperand operand) {
629629
}
630630

631631
/** Gets the start bit offset of a `MemoryLocation`, if any. */
632-
int getStartBitOffset(VariableMemoryLocation location) { result = location.getStartBitOffset() }
632+
int getStartBitOffset(VariableMemoryLocation location) {
633+
result = location.getStartBitOffset() and Ints::hasValue(result)
634+
}
633635

634636
/** Gets the end bit offset of a `MemoryLocation`, if any. */
635-
int getEndBitOffset(VariableMemoryLocation location) { result = location.getEndBitOffset() }
637+
int getEndBitOffset(VariableMemoryLocation location) {
638+
result = location.getEndBitOffset() and Ints::hasValue(result)
639+
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ private module Cached {
179179
}
180180

181181
/**
182-
* Holds if the `ChiPartialOperand` totally, but not exactly, overlaps with the `ChiTotalOperand`.
183-
* This means that the `ChiPartialOperand` will not override the entire memory associated with the
184-
* `ChiTotalOperand`.
182+
* Holds if the `ChiPartialOperand` only partially overlaps with the `ChiTotalOperand`.
183+
* This means that the `ChiPartialOperand` will not override the entire memory associated
184+
* with the `ChiTotalOperand`.
185185
*/
186186
cached
187187
predicate chiOnlyPartiallyUpdatesLocation(ChiInstruction chi) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ private module Cached {
179179
}
180180

181181
/**
182-
* Holds if the `ChiPartialOperand` totally, but not exactly, overlaps with the `ChiTotalOperand`.
183-
* This means that the `ChiPartialOperand` will not override the entire memory associated with the
184-
* `ChiTotalOperand`.
182+
* Holds if the `ChiPartialOperand` only partially overlaps with the `ChiTotalOperand`.
183+
* This means that the `ChiPartialOperand` will not override the entire memory associated
184+
* with the `ChiTotalOperand`.
185185
*/
186186
cached
187187
predicate chiOnlyPartiallyUpdatesLocation(ChiInstruction chi) {

csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ private module Cached {
179179
}
180180

181181
/**
182-
* Holds if the `ChiPartialOperand` totally, but not exactly, overlaps with the `ChiTotalOperand`.
183-
* This means that the `ChiPartialOperand` will not override the entire memory associated with the
184-
* `ChiTotalOperand`.
182+
* Holds if the `ChiPartialOperand` only partially overlaps with the `ChiTotalOperand`.
183+
* This means that the `ChiPartialOperand` will not override the entire memory associated
184+
* with the `ChiTotalOperand`.
185185
*/
186186
cached
187187
predicate chiOnlyPartiallyUpdatesLocation(ChiInstruction chi) {

0 commit comments

Comments
 (0)