Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 1 | //==--- MacOSKeychainAPIChecker.cpp ------------------------------*- C++ -*-==// |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // This checker flags misuses of KeyChainAPI. In particular, the password data |
| 10 | // allocated/returned by SecKeychainItemCopyContent, |
| 11 | // SecKeychainFindGenericPassword, SecKeychainFindInternetPassword functions has |
| 12 | // to be freed using a call to SecKeychainItemFreeContent. |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "ClangSACheckers.h" |
| 16 | #include "clang/StaticAnalyzer/Core/Checker.h" |
| 17 | #include "clang/StaticAnalyzer/Core/CheckerManager.h" |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 18 | #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 19 | #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" |
| 20 | #include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h" |
| 21 | #include "clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h" |
| 22 | |
| 23 | using namespace clang; |
| 24 | using namespace ento; |
| 25 | |
| 26 | namespace { |
| 27 | class MacOSKeychainAPIChecker : public Checker<check::PreStmt<CallExpr>, |
| 28 | check::PreStmt<ReturnStmt>, |
| 29 | check::PostStmt<CallExpr>, |
| 30 | check::EndPath > { |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 31 | mutable llvm::OwningPtr<BugType> BT; |
| 32 | |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 33 | public: |
| 34 | void checkPreStmt(const CallExpr *S, CheckerContext &C) const; |
| 35 | void checkPreStmt(const ReturnStmt *S, CheckerContext &C) const; |
| 36 | void checkPostStmt(const CallExpr *S, CheckerContext &C) const; |
| 37 | |
| 38 | void checkEndPath(EndOfFunctionNodeBuilder &B, ExprEngine &Eng) const; |
| 39 | |
| 40 | private: |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 41 | /// Stores the information about the allocator and deallocator functions - |
| 42 | /// these are the functions the checker is tracking. |
| 43 | struct ADFunctionInfo { |
| 44 | const char* Name; |
| 45 | unsigned int Param; |
| 46 | unsigned int DeallocatorIdx; |
| 47 | }; |
| 48 | static const unsigned InvalidIdx = 100000; |
Anna Zaks | 76cbb75 | 2011-08-04 21:53:01 +0000 | [diff] [blame] | 49 | static const unsigned FunctionsToTrackSize = 6; |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 50 | static const ADFunctionInfo FunctionsToTrack[FunctionsToTrackSize]; |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 51 | |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 52 | /// Given the function name, returns the index of the allocator/deallocator |
| 53 | /// function. |
| 54 | unsigned getTrackedFunctionIndex(StringRef Name, bool IsAllocator) const; |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 55 | |
| 56 | inline void initBugType() const { |
| 57 | if (!BT) |
| 58 | BT.reset(new BugType("Improper use of SecKeychain API", "Mac OS API")); |
| 59 | } |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 60 | }; |
| 61 | } |
| 62 | |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 63 | /// AllocationState is a part of the checker specific state together with the |
| 64 | /// MemRegion corresponding to the allocated data. |
| 65 | struct AllocationState { |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 66 | const Expr *Address; |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 67 | /// The index of the allocator function. |
| 68 | unsigned int AllocatorIdx; |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 69 | |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 70 | AllocationState(const Expr *E, unsigned int Idx) : Address(E), |
| 71 | AllocatorIdx(Idx) {} |
| 72 | bool operator==(const AllocationState &X) const { |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 73 | return Address == X.Address; |
| 74 | } |
| 75 | void Profile(llvm::FoldingSetNodeID &ID) const { |
| 76 | ID.AddPointer(Address); |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 77 | ID.AddInteger(AllocatorIdx); |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 78 | } |
| 79 | }; |
| 80 | |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 81 | /// GRState traits to store the currently allocated (and not yet freed) symbols. |
| 82 | typedef llvm::ImmutableMap<const MemRegion*, AllocationState> AllocatedSetTy; |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 83 | |
| 84 | namespace { struct AllocatedData {}; } |
| 85 | namespace clang { namespace ento { |
| 86 | template<> struct GRStateTrait<AllocatedData> |
| 87 | : public GRStatePartialTrait<AllocatedSetTy > { |
| 88 | static void *GDMIndex() { static int index = 0; return &index; } |
| 89 | }; |
| 90 | }} |
| 91 | |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 92 | static bool isEnclosingFunctionParam(const Expr *E) { |
| 93 | E = E->IgnoreParenCasts(); |
| 94 | if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) { |
| 95 | const ValueDecl *VD = DRE->getDecl(); |
| 96 | if (isa<ImplicitParamDecl>(VD) || isa<ParmVarDecl>(VD)) |
| 97 | return true; |
| 98 | } |
| 99 | return false; |
| 100 | } |
| 101 | |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 102 | const MacOSKeychainAPIChecker::ADFunctionInfo |
| 103 | MacOSKeychainAPIChecker::FunctionsToTrack[FunctionsToTrackSize] = { |
| 104 | {"SecKeychainItemCopyContent", 4, 3}, // 0 |
| 105 | {"SecKeychainFindGenericPassword", 6, 3}, // 1 |
| 106 | {"SecKeychainFindInternetPassword", 13, 3}, // 2 |
| 107 | {"SecKeychainItemFreeContent", 1, InvalidIdx}, // 3 |
Anna Zaks | 76cbb75 | 2011-08-04 21:53:01 +0000 | [diff] [blame] | 108 | {"SecKeychainItemCopyAttributesAndData", 5, 5}, // 4 |
| 109 | {"SecKeychainItemFreeAttributesAndData", 1, InvalidIdx}, // 5 |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | unsigned MacOSKeychainAPIChecker::getTrackedFunctionIndex(StringRef Name, |
| 113 | bool IsAllocator) const { |
| 114 | for (unsigned I = 0; I < FunctionsToTrackSize; ++I) { |
| 115 | ADFunctionInfo FI = FunctionsToTrack[I]; |
| 116 | if (FI.Name != Name) |
| 117 | continue; |
| 118 | // Make sure the function is of the right type (allocator vs deallocator). |
| 119 | if (IsAllocator && (FI.DeallocatorIdx == InvalidIdx)) |
| 120 | return InvalidIdx; |
| 121 | if (!IsAllocator && (FI.DeallocatorIdx != InvalidIdx)) |
| 122 | return InvalidIdx; |
| 123 | |
| 124 | return I; |
| 125 | } |
| 126 | // The function is not tracked. |
| 127 | return InvalidIdx; |
| 128 | } |
| 129 | |
Anna Zaks | ca0b57e | 2011-08-05 00:37:00 +0000 | [diff] [blame] | 130 | /// Given the address expression, retrieve the value it's pointing to. Assume |
| 131 | /// that value is itself an address, and return the corresponding MemRegion. |
| 132 | static const MemRegion *getAsPointeeMemoryRegion(const Expr *Expr, |
| 133 | CheckerContext &C) { |
| 134 | const GRState *State = C.getState(); |
| 135 | SVal ArgV = State->getSVal(Expr); |
| 136 | if (const loc::MemRegionVal *X = dyn_cast<loc::MemRegionVal>(&ArgV)) { |
| 137 | StoreManager& SM = C.getStoreManager(); |
| 138 | const MemRegion *V = SM.Retrieve(State->getStore(), *X).getAsRegion(); |
| 139 | return V; |
| 140 | } |
| 141 | return 0; |
| 142 | } |
| 143 | |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 144 | void MacOSKeychainAPIChecker::checkPreStmt(const CallExpr *CE, |
| 145 | CheckerContext &C) const { |
| 146 | const GRState *State = C.getState(); |
| 147 | const Expr *Callee = CE->getCallee(); |
| 148 | SVal L = State->getSVal(Callee); |
Anna Zaks | ca0b57e | 2011-08-05 00:37:00 +0000 | [diff] [blame] | 149 | unsigned idx = InvalidIdx; |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 150 | |
| 151 | const FunctionDecl *funDecl = L.getAsFunctionDecl(); |
| 152 | if (!funDecl) |
| 153 | return; |
| 154 | IdentifierInfo *funI = funDecl->getIdentifier(); |
| 155 | if (!funI) |
| 156 | return; |
| 157 | StringRef funName = funI->getName(); |
| 158 | |
Anna Zaks | ca0b57e | 2011-08-05 00:37:00 +0000 | [diff] [blame] | 159 | // If it is a call to an allocator function, it could be a double allocation. |
| 160 | idx = getTrackedFunctionIndex(funName, true); |
| 161 | if (idx != InvalidIdx) { |
| 162 | const Expr *ArgExpr = CE->getArg(FunctionsToTrack[idx].Param); |
| 163 | if (const MemRegion *V = getAsPointeeMemoryRegion(ArgExpr, C)) |
| 164 | if (const AllocationState *AS = State->get<AllocatedData>(V)) { |
| 165 | ExplodedNode *N = C.generateSink(State); |
| 166 | if (!N) |
| 167 | return; |
| 168 | initBugType(); |
| 169 | std::string sbuf; |
| 170 | llvm::raw_string_ostream os(sbuf); |
| 171 | unsigned int DIdx = FunctionsToTrack[AS->AllocatorIdx].DeallocatorIdx; |
| 172 | os << "Allocated data should be released before another call to " |
| 173 | << "the allocator: missing a call to '" |
| 174 | << FunctionsToTrack[DIdx].Name |
| 175 | << "'."; |
| 176 | RangedBugReport *Report = new RangedBugReport(*BT, os.str(), N); |
| 177 | Report->addRange(ArgExpr->getSourceRange()); |
| 178 | C.EmitReport(Report); |
| 179 | } |
| 180 | return; |
| 181 | } |
| 182 | |
| 183 | // Is it a call to one of deallocator functions? |
| 184 | idx = getTrackedFunctionIndex(funName, false); |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 185 | if (idx == InvalidIdx) |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 186 | return; |
| 187 | |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 188 | const Expr *ArgExpr = CE->getArg(FunctionsToTrack[idx].Param); |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 189 | const MemRegion *Arg = State->getSVal(ArgExpr).getAsRegion(); |
| 190 | if (!Arg) |
| 191 | return; |
| 192 | |
| 193 | // If trying to free data which has not been allocated yet, report as bug. |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 194 | const AllocationState *AS = State->get<AllocatedData>(Arg); |
| 195 | if (!AS) { |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 196 | // It is possible that this is a false positive - the argument might |
| 197 | // have entered as an enclosing function parameter. |
| 198 | if (isEnclosingFunctionParam(ArgExpr)) |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 199 | return; |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 200 | |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 201 | ExplodedNode *N = C.generateNode(State); |
| 202 | if (!N) |
| 203 | return; |
| 204 | initBugType(); |
| 205 | RangedBugReport *Report = new RangedBugReport(*BT, |
| 206 | "Trying to free data which has not been allocated.", N); |
| 207 | Report->addRange(ArgExpr->getSourceRange()); |
| 208 | C.EmitReport(Report); |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 209 | return; |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 210 | } |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 211 | |
Anna Zaks | 76cbb75 | 2011-08-04 21:53:01 +0000 | [diff] [blame] | 212 | // Check if the proper deallocator is used. |
| 213 | unsigned int PDeallocIdx = FunctionsToTrack[AS->AllocatorIdx].DeallocatorIdx; |
| 214 | if (PDeallocIdx != idx) { |
| 215 | ExplodedNode *N = C.generateSink(State); |
| 216 | if (!N) |
| 217 | return; |
| 218 | initBugType(); |
| 219 | |
| 220 | std::string sbuf; |
| 221 | llvm::raw_string_ostream os(sbuf); |
| 222 | os << "Allocator doesn't match the deallocator: '" |
| 223 | << FunctionsToTrack[PDeallocIdx].Name << "' should be used."; |
| 224 | RangedBugReport *Report = new RangedBugReport(*BT, os.str(), N); |
| 225 | Report->addRange(ArgExpr->getSourceRange()); |
| 226 | C.EmitReport(Report); |
| 227 | return; |
| 228 | } |
| 229 | |
Anna Zaks | ca0b57e | 2011-08-05 00:37:00 +0000 | [diff] [blame] | 230 | // If a value has been freed, remove it from the list and continue exploring |
| 231 | // from the new state. |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 232 | State = State->remove<AllocatedData>(Arg); |
| 233 | C.addTransition(State); |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | void MacOSKeychainAPIChecker::checkPostStmt(const CallExpr *CE, |
| 237 | CheckerContext &C) const { |
| 238 | const GRState *State = C.getState(); |
| 239 | const Expr *Callee = CE->getCallee(); |
| 240 | SVal L = State->getSVal(Callee); |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 241 | |
| 242 | const FunctionDecl *funDecl = L.getAsFunctionDecl(); |
| 243 | if (!funDecl) |
| 244 | return; |
| 245 | IdentifierInfo *funI = funDecl->getIdentifier(); |
| 246 | if (!funI) |
| 247 | return; |
| 248 | StringRef funName = funI->getName(); |
| 249 | |
| 250 | // If a value has been allocated, add it to the set for tracking. |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 251 | unsigned idx = getTrackedFunctionIndex(funName, true); |
| 252 | if (idx == InvalidIdx) |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 253 | return; |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 254 | |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 255 | const Expr *ArgExpr = CE->getArg(FunctionsToTrack[idx].Param); |
Anna Zaks | ca0b57e | 2011-08-05 00:37:00 +0000 | [diff] [blame] | 256 | if (const MemRegion *V = getAsPointeeMemoryRegion(ArgExpr, C)) { |
| 257 | // If the argument points to something that's not a region, it can be: |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 258 | // - unknown (cannot reason about it) |
| 259 | // - undefined (already reported by other checker) |
Anna Zaks | 083fcb2 | 2011-08-04 17:28:06 +0000 | [diff] [blame] | 260 | // - constant (null - should not be tracked, |
| 261 | // other constant will generate a compiler warning) |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 262 | // - goto (should be reported by other checker) |
Anna Zaks | e68b5f1 | 2011-08-02 17:11:03 +0000 | [diff] [blame] | 263 | |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 264 | // We only need to track the value if the function returned noErr(0), so |
Anna Zaks | 76cbb75 | 2011-08-04 21:53:01 +0000 | [diff] [blame] | 265 | // bind the return value of the function to 0 and proceed from the no error |
| 266 | // state. |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 267 | SValBuilder &Builder = C.getSValBuilder(); |
Anna Zaks | 76cbb75 | 2011-08-04 21:53:01 +0000 | [diff] [blame] | 268 | SVal ZeroVal = Builder.makeIntVal(0, CE->getCallReturnType()); |
| 269 | const GRState *NoErr = State->BindExpr(CE, ZeroVal); |
Anna Zaks | ca0b57e | 2011-08-05 00:37:00 +0000 | [diff] [blame] | 270 | // Add the symbolic value V, which represents the location of the allocated |
| 271 | // data, to the set. |
Anna Zaks | 76cbb75 | 2011-08-04 21:53:01 +0000 | [diff] [blame] | 272 | NoErr = NoErr->set<AllocatedData>(V, AllocationState(ArgExpr, idx)); |
| 273 | assert(NoErr); |
| 274 | C.addTransition(NoErr); |
Anna Zaks | 08551b5 | 2011-08-04 00:31:38 +0000 | [diff] [blame] | 275 | |
Anna Zaks | 76cbb75 | 2011-08-04 21:53:01 +0000 | [diff] [blame] | 276 | // Generate a transition to explore the state space when there is an error. |
| 277 | // In this case, we do not track the allocated data. |
| 278 | SVal ReturnedError = Builder.evalBinOpNN(State, BO_NE, |
| 279 | cast<NonLoc>(ZeroVal), |
| 280 | cast<NonLoc>(State->getSVal(CE)), |
| 281 | CE->getCallReturnType()); |
| 282 | const GRState *Err = State->assume(cast<NonLoc>(ReturnedError), true); |
| 283 | assert(Err); |
| 284 | C.addTransition(Err); |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 285 | } |
| 286 | } |
| 287 | |
| 288 | void MacOSKeychainAPIChecker::checkPreStmt(const ReturnStmt *S, |
| 289 | CheckerContext &C) const { |
| 290 | const Expr *retExpr = S->getRetValue(); |
| 291 | if (!retExpr) |
| 292 | return; |
| 293 | |
| 294 | // Check if the value is escaping through the return. |
| 295 | const GRState *state = C.getState(); |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 296 | const MemRegion *V = state->getSVal(retExpr).getAsRegion(); |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 297 | if (!V) |
| 298 | return; |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 299 | state = state->remove<AllocatedData>(V); |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 300 | |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 301 | // Proceed from the new state. |
| 302 | C.addTransition(state); |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | void MacOSKeychainAPIChecker::checkEndPath(EndOfFunctionNodeBuilder &B, |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 306 | ExprEngine &Eng) const { |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 307 | const GRState *state = B.getState(); |
| 308 | AllocatedSetTy AS = state->get<AllocatedData>(); |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 309 | ExplodedNode *N = B.generateNode(state); |
| 310 | if (!N) |
| 311 | return; |
| 312 | initBugType(); |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 313 | |
| 314 | // Anything which has been allocated but not freed (nor escaped) will be |
| 315 | // found here, so report it. |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 316 | for (AllocatedSetTy::iterator I = AS.begin(), E = AS.end(); I != E; ++I ) { |
Anna Zaks | 76cbb75 | 2011-08-04 21:53:01 +0000 | [diff] [blame] | 317 | const ADFunctionInfo &FI = FunctionsToTrack[I->second.AllocatorIdx]; |
| 318 | |
| 319 | std::string sbuf; |
| 320 | llvm::raw_string_ostream os(sbuf); |
| 321 | os << "Allocated data is not released: missing a call to '" |
| 322 | << FunctionsToTrack[FI.DeallocatorIdx].Name << "'."; |
| 323 | RangedBugReport *Report = new RangedBugReport(*BT, os.str(), N); |
Anna Zaks | 03826aa | 2011-08-04 00:26:57 +0000 | [diff] [blame] | 324 | // TODO: The report has to mention the expression which contains the |
| 325 | // allocated content as well as the point at which it has been allocated. |
| 326 | // Currently, the next line is useless. |
| 327 | Report->addRange(I->second.Address->getSourceRange()); |
| 328 | Eng.getBugReporter().EmitReport(Report); |
Anna Zaks | f57be28 | 2011-08-01 22:40:01 +0000 | [diff] [blame] | 329 | } |
| 330 | } |
| 331 | |
| 332 | void ento::registerMacOSKeychainAPIChecker(CheckerManager &mgr) { |
| 333 | mgr.registerChecker<MacOSKeychainAPIChecker>(); |
| 334 | } |