mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: Fix join in 'cpp/upcast-array-pointer-arithmetic'.
This commit is contained in:
@@ -64,10 +64,15 @@ predicate introducesNewField(Class derived, Class base) {
|
||||
)
|
||||
}
|
||||
|
||||
from DataFlow::PathNode source, DataFlow::PathNode sink, CastToPointerArithFlow cfg
|
||||
pragma[nomagic]
|
||||
predicate hasFullyConvertedType(DataFlow::PathNode node, Type t) {
|
||||
t = node.getNode().asExpr().getFullyConverted().getUnspecifiedType()
|
||||
}
|
||||
|
||||
from DataFlow::PathNode source, DataFlow::PathNode sink, CastToPointerArithFlow cfg, Type t
|
||||
where
|
||||
cfg.hasFlowPath(source, sink) and
|
||||
source.getNode().asExpr().getFullyConverted().getUnspecifiedType() =
|
||||
sink.getNode().asExpr().getFullyConverted().getUnspecifiedType()
|
||||
cfg.hasFlowPath(pragma[only_bind_into](source), pragma[only_bind_into](sink)) and
|
||||
hasFullyConvertedType(source, t) and
|
||||
hasFullyConvertedType(sink, t)
|
||||
select sink, source, sink, "This pointer arithmetic may be done with the wrong type because of $@.",
|
||||
source, "this cast"
|
||||
|
||||
Reference in New Issue
Block a user