| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
| |
This keeps the analyzer from making silly assumptions, like thinking
strlen(foo)+1 could wrap around to 0. This fixes PR16558.
Patch by Karthik Bhat!
llvm-svn: 188680
|
| |
|
|
|
|
|
| |
This handles the false positive leak warning in PR15374, and also serves
as a basic model for the strsep() function.
llvm-svn: 180069
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes some mistaken condition logic in RegionStore that caused
global variables to be invalidated when /any/ region was invalidated,
rather than only as part of opaque function calls. This was only
being used by CStringChecker, and so users will now see that strcpy()
and friends do not invalidate global variables.
Also, add a test case we don't handle properly: explicitly-assigned
global variables aren't being invalidated by opaque calls. This is
being tracked by <rdar://problem/13464044>.
llvm-svn: 177572
|
| |
|
|
|
|
|
|
|
|
| |
Fixes a FIXME, improves dead symbol collection, suppresses a false positive,
which resulted from reusing the same symbol twice for simulation of 2 calls to the same function.
Fixing this lead to 2 possible false negatives in CString checker. Since the checker is still alpha and
the solution will not require revert of this commit, move the tests to a FIXME section.
llvm-svn: 177206
|
| |
|
|
| |
llvm-svn: 162588
|
| |
|
|
| |
llvm-svn: 156941
|
| |
|
|
|
|
| |
This breaks the build with -triple i386-apple-darwin9.
llvm-svn: 156932
|
| |
|
|
| |
llvm-svn: 156920
|
| |
|
|
|
|
|
|
|
|
| |
We check the address of the last element accessed, but with 0 calculating that
address results in element -1. This patch bails out early (and avoids a bunch
of other work at that).
Fixes PR12807.
llvm-svn: 156769
|
| |
|
|
|
|
|
|
| |
shouldn't be converted to the result type. Fixes PR12206 and dupe PR12510.
This was probably the original intent of r133041 (also me, a year ago).
llvm-svn: 156062
|
| |
|
|
|
|
|
|
|
|
|
|
| |
checks:
- unix.Malloc - Checks for memory leaks, double free, use-after-free.
- unix.cstring.NullArg - Checks for null pointers passed as arguments to
CString functions + evaluates CString functions.
- unix.cstring.BadSizeArg - Checks for common anti-patterns in
strncat size argument.
llvm-svn: 150988
|
| |
|
|
|
|
| |
separately.
llvm-svn: 149947
|
| |
|
|
|
|
|
| |
(Since this is syntax only, might be a good candidate for turning into a
compiler warning.)
llvm-svn: 149407
|
| |
|
|
|
|
| |
looking up value at a CodeTextRegion even when the type is not provided.
llvm-svn: 148079
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
type is a pointer to const. (radar://10595327)
The regions corresponding to the pointer and reference arguments to
a function get invalidated by the calls since a function call can
possibly modify the pointed to data. With this change, we are not going
to invalidate the data if the argument is a pointer to const. This
change makes the analyzer more optimistic in reporting errors.
(Support for C, C++ and Obj C)
llvm-svn: 147002
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
UndefOrUnknown value when it cannot reason about the expression.
We are now often generating expressions even if the solver is not known to be able to simplify it. This is another cleanup of the existing code, where the rest of the analyzer and checkers should not base their logic on knowing ahead of the time what the solver can reason about.
In this case, CStringChecker is performing a check for overflow of 'left+right' operation. The overflow can be checked with either 'maxVal-left' or 'maxVal-right'. Previously, the decision was based on whether the expresion evaluated to undef or not. With this patch, we check if one of the arguments is a constant, in which case we know that 'maxVal-const' is easily simplified. (Another option is to use canReasonAbout() method of the solver here, however, it's currently is protected.)
This patch also contains 2 small bug fixes:
- swap the order of operators inside SValBuilder::makeGenericVal.
- handle a case when AddeVal is unknown in GenericTaintChecker::getPointedToSymbol.
llvm-svn: 146343
|
| |
|
|
|
|
| |
be the common root package.
llvm-svn: 136835
|
| |
|
|
| |
llvm-svn: 133994
|
| |
|
|
| |
llvm-svn: 133472
|
| |
|
|
|
|
| |
the size argument. strncat is not yet up-to-date, but I'm leaving it enabled for now (there shouldn't be any false positives, at least...)
llvm-svn: 133408
|
| |
|
|
|
|
| |
diagnostics, and make it easier to provide custom messages for overflow checking, in preparation for re-enabling strncpy checking.
llvm-svn: 133406
|
| |
|
|
|
|
| |
literal has an embedded null character, and where both arguments are the same buffer. Also use nested ifs rather than early returns; in this case early returns will lose any assumptions we've made earlier in the function.
llvm-svn: 133154
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- (bounded copies) Be more conservative about how much is being copied.
- (str(n)cat) If we can't compute the exact final length of an append operation, we can still lower-bound it.
- (stpcpy) Fix the conjured return value at the end to actually be returned.
This requires these supporting changes:
- C string metadata symbols are still live even when buried in a SymExpr.
- "Hypothetical" C string lengths, to represent a value that /will/ be passed to setCStringLength() if all goes well. (The idea is to allow for temporary constrainable symbols that may end up becoming permanent.)
- The 'checkAdditionOverflow' helper makes sure that the two strings being appended in a strcat don't overflow size_t. This should never *actually* happen; the real effect is to keep the final string length from "wrapping around" in the constraint manager.
This doesn't actually test the "bounded" operations (strncpy and strncat) because they can leave strings unterminated. Next on the list!
llvm-svn: 133046
|
| |
|
|
|
|
| |
C++. Its external name is now unix.experimental.CString.
llvm-svn: 132958
|
| |
|
|
|
|
| |
can't properly model (yet?) to string-fail.c.
llvm-svn: 132955
|
| |
|
|
|
|
| |
changes need to be made to properly support modeling of it since it potentially leaves strings non-null terminated.
llvm-svn: 130758
|
| |
|
|
|
|
| |
creating substrings if necessary and calling the appropriate StringRef::compare/compare_lower().
llvm-svn: 130708
|
| |
|
|
| |
llvm-svn: 130398
|
| |
|
|
|
|
| |
Addresses rdar://9269271.
llvm-svn: 130207
|
| |
|
|
|
|
| |
bounds. Requires LLVM svn r129582.
llvm-svn: 130161
|
| |
|
|
|
|
| |
Luis Felipe Strano Moraes!
llvm-svn: 129559
|
| |
|
|
|
|
| |
inputs are not NULL and are real C strings, then does the comparison and binds the proper return value. Unit tests included.
llvm-svn: 129364
|
| |
|
|
|
|
| |
Validates inputs are not NULL, checks for overlapping strings, concatenates the strings checking for buffer overflow, sets the length of the destination string to the sum of the s1 length and the s2 length, binds the return value to the s1 value.
llvm-svn: 129215
|
| |
|
|
| |
llvm-svn: 128187
|
| |
|
|
|
|
| |
list". Sorry, folks!
llvm-svn: 127188
|
| |
|
|
|
|
| |
misnomer award.
llvm-svn: 126676
|
| |
|
|
|
|
|
|
| |
They cooperate in that NSErrorChecker listens for ImplicitNullDerefEvent events that
DereferenceChecker can dispatch.
ImplicitNullDerefEvent is when we dereferenced a location that may be null.
llvm-svn: 126659
|
| |
|
|
|
|
| |
-analyzer-checker=cocoa,unix
llvm-svn: 126372
|
| |
|
|
| |
llvm-svn: 126188
|
| |
|
|
| |
llvm-svn: 126187
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
checks. These are:
CStringChecker
ChrootChecker
MallocChecker
PthreadLockChecker
StreamChecker
UnreachableCodeChecker
MallocChecker creates implicit dependencies between checkers and needs to be handled differently.
llvm-svn: 125598
|
| |
|
|
|
|
|
|
| |
- Fix memcpy() and friends to actually invalidate the destination buffer.
- Emit a different message for out-of-bounds buffer accesses if the buffer is being written to.
- When conjuring symbols, let ValueManager figure out the type.
llvm-svn: 111120
|
| |
|
|
|
|
| |
region change callback. Now does basic tracking of string length for general regions. Currently this is still only used for modeling strlen().
llvm-svn: 111081
|
| |
|
|
|
|
|
|
|
| |
- Allowed reporting of dead macros
- Added path walking function to search for false positives in conditional statements
- Updated some affected tests
- Added some false positive test cases
llvm-svn: 109561
|
|
|
of constant string literals, which is not too helpful, and only calls to strlen() are checked.
llvm-svn: 109480
|