You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nice tool! I played the demo a little bit and found two cases where the analysis does not work very well.
False positive example:
voidmayLeakResource() throwsIOException {
OutputStreamstream = Resources.allocateResource();
if (stream == null) {
return;
}
try {
stream.write(12); // false positive, warns about unclosed stream
} finally {
mayClose(stream, -10);
}
}
voidmayClose(OutputStreamstream, doublevalue) {
if (value < 0) { // remove this condition, however, the warning goes awaytry {
stream.close();
} catch (Exceptionex) {}
}
}
It seems that in the analysis, the stream argument flows into the mayClose function. And it is reasonable to infer that -10 also flows into the value argument. The analyzer should be able to learn that value < 0 is true, and reports no warning.
Another example of false negative, this is probably due to the lack of symbolic summary of built-in functions.
False negative example:
voidmayLeakResource() throwsIOException {
OutputStreamstream = Resources.allocateResource();
if (stream == null) {
return;
}
try {
stream.write(12); // the analyzer should report warning here, but it didn't
} finally {
mayClose(stream);
}
}
voidmayClose(OutputStreamstream) {
if (Math.random() > 100) {
try {
stream.close(); // false negative
} catch (Exceptionex) {}
}
}
The text was updated successfully, but these errors were encountered:
Nice tool! I played the demo a little bit and found two cases where the analysis does not work very well.
False positive example:
It seems that in the analysis, the
stream
argument flows into themayClose
function. And it is reasonable to infer that-10
also flows into thevalue
argument. The analyzer should be able to learn thatvalue < 0
is true, and reports no warning.Another example of false negative, this is probably due to the lack of symbolic summary of built-in functions.
False negative example:
The text was updated successfully, but these errors were encountered: