CodeQL library for C/C++
Search

Module Negativity

Import path

import Critical.Negativity

Imports

cpp

Provides classes and predicates for working with C/C++ code.

Predicates

boundsCheckExpr

Holds if either: - cond is an (in)equality expression that compares the variable v to the value -1, or - cond is a relational expression that compares the variable v to a constant.

boundsChecked

Holds if the current value of the variable v at control-flow node n has been used either in: - an (in)equality comparison with the value -1, or - a relational comparison that compares v to a constant.

checkedError

Holds if the current value of the variable v at control-flow node n may have been checked against a common set of error values.

checkedSuccess

Holds if the current value of the variable v at control-flow node n may have been checked against a common set of success values.

conditionalSuccessor

Holds if node is an expression in a conditional statement and succ is an immediate successor of node that may be reached after evaluating node. For example, given if (a < 10 && b) func1(); else func2(); this predicate holds when either: - node is a < 10 and succ is func2() or b, or - node is b and succ is func1() or func2()

errorCondition

Holds if cond compares v to some common error values. Specifically, this predicate holds when: - cond checks that v is equal to -1, or - cond checks that v is less than 0, or - cond checks that v is less than or equal to -1, or - cond checks that v is not some common success value (see successCondition).

errorSuccessor

Holds if there exists a comparison operation that checks whether v represents some common error values, and n may be reached immediately following the comparison operation.

successCondition

Holds if cond compares v to some common success values. Specifically, this predicate holds when: - cond checks that v is not equal to -1, or - cond checks that v is greater than or equal than 0, or - cond checks that v is greater than -1, or - cond checks that v is not some common error value (see errorCondition).

successSuccessor

Holds if there exists a comparison operation that checks whether v represents some common success values, and n may be reached immediately following the comparison operation.

valueOfVar

Holds if val is an access to the variable v, or if val is an assignment with an access to v on the left-hand side.