C++: Use the new API in queries.

This commit is contained in:
Mathias Vorreiter Pedersen
2025-03-12 17:09:05 +00:00
parent 66e8b2d7e5
commit aeb1acba97
5 changed files with 8 additions and 6 deletions

View File

@@ -37,7 +37,7 @@ module Config implements DataFlow::ConfigSig {
predicate isBarrier(DataFlow::Node node) {
isSink(node) and node.asExpr().getUnspecifiedType() instanceof ArithmeticType
or
node.asInstruction().(StoreInstruction).getResultType() instanceof ArithmeticType
node.asCertainDefinition().getUnspecifiedType() instanceof ArithmeticType
}
}

View File

@@ -37,7 +37,7 @@ module Config implements DataFlow::ConfigSig {
predicate isBarrier(DataFlow::Node node) {
isSink(node) and node.asExpr().getUnspecifiedType() instanceof ArithmeticType
or
node.asInstruction().(StoreInstruction).getResultType() instanceof ArithmeticType
node.asCertainDefinition().getUnspecifiedType() instanceof ArithmeticType
}
}

View File

@@ -42,7 +42,7 @@ module Config implements DataFlow::ConfigSig {
predicate isBarrier(DataFlow::Node node) {
isSink(node) and isArithmeticNonCharType(node.asExpr().getUnspecifiedType())
or
isArithmeticNonCharType(node.asInstruction().(StoreInstruction).getResultType())
isArithmeticNonCharType(node.asCertainDefinition().getUnspecifiedType())
}
}

View File

@@ -37,7 +37,7 @@ private module Config implements DataFlow::ConfigSig {
predicate isBarrier(DataFlow::Node node) {
isSink(node) and node.asExpr().getUnspecifiedType() instanceof ArithmeticType
or
node.asInstruction().(StoreInstruction).getResultType() instanceof ArithmeticType
node.asCertainDefinition().getUnspecifiedType() instanceof ArithmeticType
or
mayAddNullTerminator(_, node.asIndirectExpr())
}

View File

@@ -75,9 +75,11 @@ module Config implements DataFlow::ConfigSig {
predicate isSink(DataFlow::Node sink) { isSink(sink, _, _) }
predicate isBarrier(DataFlow::Node node) {
exists(StoreInstruction store | store = node.asInstruction() |
exists(StoreInstruction store, Expr e |
store = node.asInstruction() and e = node.asCertainDefinition()
|
// Block flow to "likely small expressions"
bounded(store.getSourceValue().getUnconvertedResultExpression())
bounded(e)
or
// Block flow to "small types"
store.getResultType().getUnspecifiedType().(IntegralType).getSize() <= 1