History log of /llvm-project/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (Results 301 – 325 of 397)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 0d6989bd 22-Jun-2012 Anna Zaks <ganna@apple.com>

[analyzer] Malloc: Warn about use-after-free when memory ownership was
transfered with dataWithBytesNoCopy.

llvm-svn: 158958


# 886dfb8c 20-Jun-2012 Anna Zaks <ganna@apple.com>

[analyzer] Malloc leak false positive: Allow xpc context to escape.

llvm-svn: 158875


# 9050ffd5 20-Jun-2012 Anna Zaks <ganna@apple.com>

[analyzer] Malloc: cleanup, disallow free on relinquished memory.

This commits sets the grounds for more aggressive use after free
checking. We will use the Relinquished sate to denote that someone

[analyzer] Malloc: cleanup, disallow free on relinquished memory.

This commits sets the grounds for more aggressive use after free
checking. We will use the Relinquished sate to denote that someone
else is now responsible for releasing the memory.

llvm-svn: 158850

show more ...


# 42908c7a 19-Jun-2012 Anna Zaks <ganna@apple.com>

[analyzer] Allow pointers to escape into NSPointerArray.
(Fixes radar://11691035 PR13140)

llvm-svn: 158703


# de409b6d 16-Jun-2012 Jordan Rose <jordan_rose@apple.com>

[analyzer] Buffers passed to CGBitmapContextCreate can escape.

Specifically, although the bitmap context does not take ownership of the
buffer (unlike CGBitmapContextCreateWithData), the data buffer

[analyzer] Buffers passed to CGBitmapContextCreate can escape.

Specifically, although the bitmap context does not take ownership of the
buffer (unlike CGBitmapContextCreateWithData), the data buffer can be extracted
out of the created CGContextRef. Thus the buffer is not leaked even if its
original pointer goes out of scope, as long as
- the context escapes, or
- it is retrieved via CGBitmapContextGetData and freed.

Actually implementing that logic is beyond the current scope of MallocChecker,
so for now CGBitmapContextCreate goes on our system function exception list.

llvm-svn: 158579

show more ...


# 3563fde6 07-Jun-2012 Anna Zaks <ganna@apple.com>

[analyzer] Anti-aliasing: different heap allocations do not alias

Add a concept of symbolic memory region belonging to heap memory space.
When comparing symbolic regions allocated on the heap, assum

[analyzer] Anti-aliasing: different heap allocations do not alias

Add a concept of symbolic memory region belonging to heap memory space.
When comparing symbolic regions allocated on the heap, assume that they
do not alias.

Use symbolic heap region to suppress a common false positive pattern in
the malloc checker, in code that relies on malloc not returning the
memory aliased to other malloc allocations, stack.

llvm-svn: 158136

show more ...


# 474261af 02-Jun-2012 Benjamin Kramer <benny.kra@googlemail.com>

Fix typos found by http://github.com/lyda/misspell-check

llvm-svn: 157886


# b3436609 18-May-2012 Anna Zaks <ganna@apple.com>

[analyzer] Malloc checker: remove unnecessary comparisons.

llvm-svn: 157081


# 46d01605 18-May-2012 Anna Zaks <ganna@apple.com>

[analyzer]Malloc: refactor and report use after free by memory
allocating functions.

llvm-svn: 157037


Revision tags: llvmorg-3.1.0
# 62cce9e4 10-May-2012 Anna Zaks <ganna@apple.com>

[analyzer] Do not highlight the range of the statement in case of leak.

We report a leak at a point a leaked variable is no longer accessible.
The statement that happens to be at that point is not r

[analyzer] Do not highlight the range of the statement in case of leak.

We report a leak at a point a leaked variable is no longer accessible.
The statement that happens to be at that point is not relevant to the
leak diagnostic and, thus, should not be highlighted.

radar://11178519

llvm-svn: 156530

show more ...


Revision tags: llvmorg-3.1.0-rc3
# 228f9c7b 03-May-2012 Anna Zaks <ganna@apple.com>

[analyzer] Allow pointers escape through calls containing callback args.

(Since we don't have a generic pointer escape callback, modify
ExprEngineCallAndReturn as well as the malloc checker.)

llvm-

[analyzer] Allow pointers escape through calls containing callback args.

(Since we don't have a generic pointer escape callback, modify
ExprEngineCallAndReturn as well as the malloc checker.)

llvm-svn: 156134

show more ...


Revision tags: llvmorg-3.1.0-rc2
# 263b7e01 02-May-2012 Anna Zaks <ganna@apple.com>

[analyzer] Fix the 'ptr = ptr' false negative in the Malloc checker.

llvm-svn: 155963


Revision tags: llvmorg-3.1.0-rc1
# b508d29b 10-Apr-2012 Anna Zaks <ganna@apple.com>

[analyzer] Don't crash even when the system functions are redefined.
(Applied changes to CStringAPI, Malloc, and Taint.)

This might almost never happen, but we should not crash even if it does.
This

[analyzer] Don't crash even when the system functions are redefined.
(Applied changes to CStringAPI, Malloc, and Taint.)

This might almost never happen, but we should not crash even if it does.
This fixes a crash on the internal analyzer buildbot, where postgresql's
configure was redefining memmove (radar://11219852).

llvm-svn: 154451

show more ...


# 90ab9bfa 30-Mar-2012 Anna Zaks <ganna@apple.com>

[analyzer]Malloc,RetainRelease: Allow pointer to escape via NSMapInsert.

Fixes a false positive (radar://11152419). The current solution of
adding the info into 3 places is quite ugly. Pending a gen

[analyzer]Malloc,RetainRelease: Allow pointer to escape via NSMapInsert.

Fixes a false positive (radar://11152419). The current solution of
adding the info into 3 places is quite ugly. Pending a generic pointer
escapes callback.

llvm-svn: 153731

show more ...


# a651c409 26-Mar-2012 Anna Zaks <ganna@apple.com>

[analyzer] Malloc: Allow a pointer to escape through OSAtomicEnqueue.

llvm-svn: 153453


# 21ff76e9 24-Mar-2012 Jordy Rose <jediknil@belkadan.com>

[analyzer] Tighten up the realloc() failure path note generation...make sure we get the right realloc()!

llvm-svn: 153370


# 43a9af73 24-Mar-2012 Jordy Rose <jediknil@belkadan.com>

[analyzer] Restart path diagnostic generation if any of the visitors change the report configuration while walking the path.

This required adding a change count token to BugReport, but also allowed

[analyzer] Restart path diagnostic generation if any of the visitors change the report configuration while walking the path.

This required adding a change count token to BugReport, but also allowed us to ditch ImmutableList as the BugReporterVisitor data type.

Also, remove the hack from MallocChecker, now that visitors appear in the opposite order. This is not exactly a fix, but the common case -- custom diagnostics after generic ones -- is now the default behavior.

llvm-svn: 153369

show more ...


# f78877e9 24-Mar-2012 Jordy Rose <jediknil@belkadan.com>

[analyzer] Add a clone() method to BugReporterVisitor, so that we'll be able to reset diagnostic generation.

llvm-svn: 153368


# 9fe8098e 22-Mar-2012 Anna Zaks <ganna@apple.com>

[analyzer] Malloc: drop symbols captured by blocks.

llvm-svn: 153232


# c25c5e0b 21-Mar-2012 Benjamin Kramer <benny.kra@googlemail.com>

Remove unused variable, fix indentation.

llvm-svn: 153220


# fc2e1534 21-Mar-2012 Anna Zaks <ganna@apple.com>

[analyzer] Malloc: Utter the name of the leaked variable.
Specifically, we use the last store of the leaked symbol in the leak diagnostic.
(No support for struct fields since the malloc checker doesn

[analyzer] Malloc: Utter the name of the leaked variable.
Specifically, we use the last store of the leaked symbol in the leak diagnostic.
(No support for struct fields since the malloc checker doesn't track those
yet.)

+ Infrastructure to track the regions used in store evaluations.
This approach is more precise than iterating the store to
obtain the region bound to the symbol, which is used in RetainCount
checker. The region corresponds to what is uttered in the code in the
last store and we do not rely on the store implementation to support
this functionality.

llvm-svn: 153212

show more ...


# bf38f20e 18-Mar-2012 Jordy Rose <jediknil@belkadan.com>

[analyzer] Mark a failed-realloc's result as an interesting symbol between the realloc call and the null check, so we get nicer path notes. Fixes a regression introduced by the diagnostic pruning add

[analyzer] Mark a failed-realloc's result as an interesting symbol between the realloc call and the null check, so we get nicer path notes. Fixes a regression introduced by the diagnostic pruning added in r152361.

This is accomplished by calling markInteresting /during/ path diagnostic generation, and as such relies on deterministic ordering of BugReporterVisitors -- namely, that BugReporterVisitors are run in /reverse/ order from how they are added. (Right now that's a consequence of storing visitors in an ImmutableList, where new items are added to the front.) It's a little hacky, but it works for now.

I think this is the best we can do without storing the relation between the old and new symbols, and that would be a hit whether or not there ends up being an error.

llvm-svn: 153010

show more ...


# a7f457a5 16-Mar-2012 Anna Zaks <ganna@apple.com>

[analyzer] Shorten the stack hint diagnostic.

Do not display the standard "Returning from 'foo'", when a stack hint is
available.

llvm-svn: 152964


# cba4f298 16-Mar-2012 Anna Zaks <ganna@apple.com>

[analyzer] Create symbol-aware stack hints (building upon r152837).

The symbol-aware stack hint combines the checker-provided message
with the information about how the symbol was passed to the call

[analyzer] Create symbol-aware stack hints (building upon r152837).

The symbol-aware stack hint combines the checker-provided message
with the information about how the symbol was passed to the callee: as
a parameter or a return value.

For malloc, the generated messages look like this :
"Returning from 'foo'; released memory via 1st parameter"
"Returning from 'foo'; allocated memory via 1st parameter"
"Returning from 'foo'; allocated memory returned"
"Returning from 'foo'; reallocation of 1st parameter failed"


(We are yet to handle cases when the symbol is a field in a struct or
an array element.)

llvm-svn: 152962

show more ...


# 1ff57d57 15-Mar-2012 Anna Zaks <ganna@apple.com>

[analyzer] Allow checkers to supply call stack diagnostic hints for the
BugVisitor DiagnosticPieces.

When checkers create a DiagnosticPieceEvent, they can supply an extra
string, which will be conca

[analyzer] Allow checkers to supply call stack diagnostic hints for the
BugVisitor DiagnosticPieces.

When checkers create a DiagnosticPieceEvent, they can supply an extra
string, which will be concatenated with the call exit message for every
call on the stack between the diagnostic event and the final bug report.
(This is a simple version, which could be/will be further enhanced.)

For example, this is used in Malloc checker to produce the ",
which allocated memory" in the following example:

static char *malloc_wrapper() { // 2. Entered call from 'use'
return malloc(12); // 3. Memory is allocated
}

void use() {
char *v;
v = malloc_wrapper(); // 1. Calling 'malloc_wrappers'
// 4. Returning from 'malloc_wrapper', which allocated memory
} // 5. Memory is never released; potential
memory leak

llvm-svn: 152837

show more ...


1...<<111213141516