FALSE NEGATIVE: NULLPTR_DEREFERENCE misses a local null in a FileChannel catch path
- Dominant language
- OCaml
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 19h 36m
- Merged PRs (30d)
- 13
Description
Hi, I found a false negative in Infer 1.3.0 when the catch block initializes object to null and immediately dereferences it.
**Affected checker**
`Infer NULLPTR_DEREFERENCE`
**Minimal reproducer**
```java
import java.io.IOException;
import java.nio.channels.FileChannel;
class InferNullFileChannelCatch {
String test(FileChannel channel) {
try {
channel.tryLock();
return "";
} catch (IOException exception) {
Object object = null;
return object.toString();
}
}
}
```
**Reproduction command**
```bash
infer --version
infer run --pulse --enable-issue-type NULLPTR_DEREFERENCE -- javac infer-nullptr-fn-filechannel-catch.java
```
**Current behavior**
Infer completes successfully but produces no `NULLPTR_DEREFERENCE` finding. The same catch body is reported when `FileChannel.tryLock()` is replaced with `InputStream.read()`.
**Expected behavior**
Infer should report `NULLPTR_DEREFERENCE` at line 11 because the catch block initializes object to null and immediately dereferences it.
Contributor guide
Assessment
This issue has not been assessed yet.