mirror of
https://github.com/hohn/codeql-workshop-dataflow-c.git
synced 2025-12-16 18:43:03 +01:00
Remove guardEnsuresEqUnordered and update tests
GuardCondition::ensuresEq is sufficient. Update test-cases and expected results + removed a QL warning
This commit is contained in:
@@ -24,17 +24,6 @@ class TypeValidationCall extends FunctionCall {
|
||||
TypeValidationCall() { this.getTarget().hasName("DYN_INPUT_TYPE") }
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `op1` and `op2` are checked for equality in any order
|
||||
* with no distinction between left and right operands of the equality check
|
||||
*/
|
||||
predicate guardEnsuresEqUnordered(
|
||||
Expr op1, Expr op2, GuardCondition guard, BasicBlock block, boolean areEqual
|
||||
) {
|
||||
guard.ensuresEq(op1, op2, 0, block, areEqual) or
|
||||
guard.ensuresEq(op2, op1, 0, block, areEqual)
|
||||
}
|
||||
|
||||
/**
|
||||
* Relates a `call` to a `guard`, which uses the result of the call to validate
|
||||
* equality of the result of `call` against `other` to guard `block`.
|
||||
@@ -44,7 +33,7 @@ predicate typeValidationGuard(
|
||||
) {
|
||||
exists(Expr dest |
|
||||
DataFlow::localExprFlow(call, dest) and
|
||||
guardEnsuresEqUnordered(dest, other, guard, block, true) and
|
||||
guard.ensuresEq(dest, other, 0, block, true) and
|
||||
InputTypesToTypeValidation::hasFlowToExpr(other)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user