[PATCH] [analyzer] Detect use-after-free scenarios in -dealloc after calling [super dealloc]

David Kilzer ddkilzer at kilzer.net
Sat Aug 23 17:19:36 PDT 2014


Hi jordan_rose, krememek,

Use ASTMatchers (with manual matching code for finding calls to
'[super dealloc]') to detect use-after-free scenarios in the
-dealloc method.  Fixes <rdar://problem/6953275>.

Unresolved issues:
- Crash in ASTMatchers running test/Analysis/PR2978.m test,
  possibly due to invalid code in -dealloc method.  Haven't
  figured out how to make a stand-alone test case yet.
- Had to add libclangASTMatchers.a to USEDLIBS in
  tools/clang-check/Makefile and tools/driver/Makefile.  Not
  sure if that's a direction the clang project wants to go.

http://reviews.llvm.org/D5042

Files:
  lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
  test/Analysis/DeallocUseAfterFreeErrors.m
  tools/clang-check/Makefile
  tools/driver/Makefile
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5042.12884.patch
Type: text/x-patch
Size: 13294 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140824/642dbbb4/attachment.bin>


More information about the cfe-commits mailing list