[PATCH] D28330: [analyzer] Fix false positives in Keychain API checker

Anna Zaks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 4 14:57:31 PST 2017


zaks.anna created this revision.
zaks.anna added a reviewer: dcoughlin.
zaks.anna added subscribers: cfe-commits, dergachev.a.

The checker has several false positives that this patch addresses:

  1. Do not check if the return status has been compared to error (or no error) at the time when leaks are reported since the status symbol might no longer be alive. Instead, pattern match on the assume and stop tracking allocated symbols on error paths.
  2. The checker used to report error when an unknown symbol was freed. This could lead to false positives, let's not repot those. This leads to loss of coverage in double frees.
  3. Do not enforce that we should only call free if we are sure that error was not returned and the pointer is not null. That warning is too noisy and we received several false positive reports about it. (I removed: "Only call free if a valid (non-NULL) buffer was returned")
1. Use !isDead instead of isLive in leak reporting. Otherwise, we report leaks for objects we loose track of. This change triggered change #1.

This also adds checker specific dump to the state.


https://reviews.llvm.org/D28330

Files:
  lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
  test/Analysis/keychainAPI.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28330.83146.patch
Type: text/x-patch
Size: 15174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170104/20b050ec/attachment-0001.bin>


More information about the cfe-commits mailing list