when i run coverity scan on python code (static code analysis), REVERSE_INULL and FORWARD_NULL error are detected. can anyone tell what is difference between REVERSE_INULL and FORWARD_NULL ? why these error are detected.
Asked
Active
Viewed 3,959 times
1 Answers
7
REVERSE_INULL
means that you have a dereference followed by a null-type check.
In pseudo code
x := null
...
x.deref
...
if x is null
# handle null-type x
The fix would be to put the null-type check before the dereference.
FORWARD_NULL
is simply where there is a path for a null-valued variable to be dereferenced. Another pseudo-code example
x := null
...
if x is null
print warning
# but x is still null
x.deref
Here you have to ensure that the null-ness is always handled.
So ultimately I'd say that REVERSE_INULL
does the same null dereference checking as FORWARD_NULL
but that it additionally detects a check after the dereference.
(standard disclaimer - I used to work for Synopsys, but not the division producing Coverity).

Paul Floyd
- 5,530
- 5
- 29
- 43