mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: Use 'arrayTypeCand' in 'isSourceImpl' instead of checking for array size explicitly.
This commit is contained in:
@@ -78,7 +78,10 @@ predicate isInvalidPointerDerefSink2(DataFlow::Node sink, Instruction i, string
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
predicate arrayTypeCand(ArrayType arrayType) { any(Variable v).getUnspecifiedType() = arrayType }
|
predicate arrayTypeCand(ArrayType arrayType) {
|
||||||
|
any(Variable v).getUnspecifiedType() = arrayType and
|
||||||
|
exists(arrayType.getArraySize())
|
||||||
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate arrayTypeHasSizes(ArrayType arr, int baseTypeSize, int arraySize) {
|
predicate arrayTypeHasSizes(ArrayType arr, int baseTypeSize, int arraySize) {
|
||||||
@@ -143,7 +146,7 @@ predicate isSourceImpl(DataFlow::Node source, Variable v) {
|
|||||||
or
|
or
|
||||||
source.asInstruction().(VariableAddressInstruction).getAstVariable() = v
|
source.asInstruction().(VariableAddressInstruction).getAstVariable() = v
|
||||||
) and
|
) and
|
||||||
exists(v.getUnspecifiedType().(ArrayType).getArraySize())
|
arrayTypeCand(v.getUnspecifiedType())
|
||||||
}
|
}
|
||||||
|
|
||||||
module ArrayAddressToDerefConfig implements DataFlow::StateConfigSig {
|
module ArrayAddressToDerefConfig implements DataFlow::StateConfigSig {
|
||||||
|
|||||||
Reference in New Issue
Block a user