Hi, I found a false negative in Infer 1.3.0 when Files.newInputStream() returns a stream that is used but never closed.
Affected tool
Infer 1.3.0
Affected checker
Infer PULSE_RESOURCE_LEAK
Minimal reproducer
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
class InferLeakFilesNewInputStream {
void test(Path path) throws IOException {
InputStream stream = Files.newInputStream(path);
stream.read();
}
}
Reproduction command
infer --version
infer run --pulse --enable-issue-type PULSE_RESOURCE_LEAK -- javac spotbugs-to-infer-resourceleak-fn-files-new-input-stream.java
Current behavior
Infer completes successfully but produces no PULSE_RESOURCE_LEAK finding.
Expected behavior
Infer should report PULSE_RESOURCE_LEAK at line 8 because Files.newInputStream() returns an InputStream that is used but never closed.
Hi, I found a false negative in Infer 1.3.0 when
Files.newInputStream()returns a stream that is used but never closed.Affected tool
Infer 1.3.0Affected checker
Infer PULSE_RESOURCE_LEAKMinimal reproducer
Reproduction command
Current behavior
Infer completes successfully but produces no
PULSE_RESOURCE_LEAKfinding.Expected behavior
Infer should report
PULSE_RESOURCE_LEAKat line 8 becauseFiles.newInputStream()returns anInputStreamthat is used but never closed.