mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
C++: Fix SSA for array writes.
This commit is contained in:
@@ -157,11 +157,11 @@ private module Cached {
|
|||||||
predicate isUse(boolean certain, Operand op, Instruction base, int ind, int indirectionIndex) {
|
predicate isUse(boolean certain, Operand op, Instruction base, int ind, int indirectionIndex) {
|
||||||
not ignoreOperand(op) and
|
not ignoreOperand(op) and
|
||||||
certain = true and
|
certain = true and
|
||||||
exists(LanguageType type, int m, int ind0 |
|
exists(LanguageType type, int upper, int ind0 |
|
||||||
type = getLanguageType(op) and
|
type = getLanguageType(op) and
|
||||||
m = countIndirectionsForCppType(type) and
|
upper = countIndirectionsForCppType(type) and
|
||||||
isUseImpl(op, base, ind0) and
|
isUseImpl(op, base, ind0) and
|
||||||
ind = ind0 + [0 .. m] and
|
ind = ind0 + [0 .. upper] and
|
||||||
indirectionIndex = ind - ind0
|
indirectionIndex = ind - ind0
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ private module Cached {
|
|||||||
int indirectionIndex
|
int indirectionIndex
|
||||||
) {
|
) {
|
||||||
certain = true and
|
certain = true and
|
||||||
exists(int ind0, CppType type, int m |
|
exists(int ind0, CppType type, int lower, int upper |
|
||||||
address =
|
address =
|
||||||
[
|
[
|
||||||
instr.(StoreInstruction).getDestinationAddressOperand(),
|
instr.(StoreInstruction).getDestinationAddressOperand(),
|
||||||
@@ -216,9 +216,10 @@ private module Cached {
|
|||||||
|
|
|
|
||||||
isDefImpl(address, base, ind0) and
|
isDefImpl(address, base, ind0) and
|
||||||
type = getLanguageType(address) and
|
type = getLanguageType(address) and
|
||||||
m = countIndirectionsForCppType(type) and
|
upper = countIndirectionsForCppType(type) and
|
||||||
ind = ind0 + [1 .. m] and
|
ind = ind0 + [lower .. upper] and
|
||||||
indirectionIndex = ind - (ind0 + 1)
|
indirectionIndex = ind - (ind0 + lower) and
|
||||||
|
if type.hasType(any(Cpp::ArrayType arrayType), true) then lower = 0 else lower = 1
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user